• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

supabase / storage / 30379780849

28 Jul 2026 04:45PM UTC coverage: 53.191% (-27.1%) from 80.307%
30379780849

Pull #1269

github

web-flow
Merge 2846843fa into 20927735c
Pull Request #1269: fix: update pool reliably upon config changes

3671 of 7490 branches covered (49.01%)

Branch coverage included in aggregate %.

42 of 47 new or added lines in 4 files covered. (89.36%)

3545 existing lines in 156 files now uncovered.

7065 of 12694 relevant lines covered (55.66%)

71.05 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

29.41
/src/http/routes/render/renderAuthenticatedImage.ts
1
import { getTenantConfig } from '@internal/database'
2
import { ImageRenderer } from '@storage/renderer'
3
import { FastifyInstance } from 'fastify'
4
import { FromSchema } from 'json-schema-to-ts'
5
import { getConfig } from '../../../config'
6
import { sharedErrorResponseSchemas } from '../../schemas/error'
7
import { transformationOptionsSchema } from '../../schemas/transformations'
8
import { ROUTE_OPERATIONS } from '../operations'
9

10
const { storageS3Bucket, isMultitenant } = getConfig()
8✔
11

12
const renderAuthenticatedImageParamsSchema = {
8✔
13
  type: 'object',
14
  properties: {
15
    bucketName: { type: 'string', examples: ['avatars'] },
16
    '*': { type: 'string', examples: ['folder/cat.png'] },
17
  },
18
  required: ['bucketName', '*'],
19
} as const
20

21
const renderImageQuerySchema = {
8✔
22
  type: 'object',
23
  properties: {
24
    ...transformationOptionsSchema,
25
    download: { type: 'string', examples: ['filename.png'] },
26
  },
27
} as const
28

29
interface renderImageRequestInterface {
30
  Params: FromSchema<typeof renderAuthenticatedImageParamsSchema>
31
  Querystring: FromSchema<typeof renderImageQuerySchema>
32
}
33

34
export default async function routes(fastify: FastifyInstance) {
35
  const summary = 'Render an authenticated image with the given transformations'
2✔
36
  fastify.get<renderImageRequestInterface>(
2✔
37
    '/authenticated/:bucketName/*',
38
    {
39
      schema: {
40
        params: renderAuthenticatedImageParamsSchema,
41
        querystring: renderImageQuerySchema,
42
        summary,
43
        response: sharedErrorResponseSchemas,
44
        tags: ['transformation'],
45
      },
46
      config: {
47
        operation: ROUTE_OPERATIONS.RENDER_AUTH_IMAGE,
48
      },
49
    },
50
    async (request, response) => {
UNCOV
51
      const { download } = request.query
×
UNCOV
52
      const { bucketName } = request.params
×
UNCOV
53
      const objectName = request.params['*']
×
54

UNCOV
55
      const obj = await request.storage
×
56
        .from(bucketName)
57
        .findObject(objectName, 'id,version,metadata')
58

UNCOV
59
      const s3Key = request.storage.location.getKeyLocation({
×
60
        tenantId: request.tenantId,
61
        bucketId: bucketName,
62
        objectName,
63
      })
64

UNCOV
65
      const renderer = request.storage.renderer('image') as ImageRenderer
×
66

UNCOV
67
      if (isMultitenant) {
×
68
        const tenantConfig = await getTenantConfig(request.tenantId)
×
69
        renderer.setLimits({
×
70
          maxResolution: tenantConfig.features.imageTransformation.maxResolution,
71
        })
72
      }
73

UNCOV
74
      return renderer.setTransformations(request.query).render(request, response, {
×
75
        bucket: storageS3Bucket,
76
        key: s3Key,
77
        version: obj.version,
78
        download,
79
        xRobotsTag: obj.metadata?.['xRobotsTag'] as string | undefined,
80
        signal: request.signals.disconnect.signal,
81
      })
82
    }
83
  )
84
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc