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

supabase / storage / 29003813455

09 Jul 2026 08:09AM UTC coverage: 79.236% (+0.008%) from 79.228%
29003813455

Pull #1217

github

web-flow
Merge b21ea8fc3 into 34a4d397b
Pull Request #1217: fix: cache fast path and less allocations for outcome

5319 of 7277 branches covered (73.09%)

Branch coverage included in aggregate %.

8 of 11 new or added lines in 3 files covered. (72.73%)

3822 existing lines in 164 files now uncovered.

10403 of 12565 relevant lines covered (82.79%)

422.33 hits per line

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

82.35
/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 { transformationOptionsSchema } from '../../schemas/transformations'
7
import { ROUTE_OPERATIONS } from '../operations'
8

9
const { storageS3Bucket, isMultitenant } = getConfig()
30✔
10

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

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

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

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

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

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

UNCOV
64
      const renderer = request.storage.renderer('image') as ImageRenderer
1✔
65

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

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

© 2026 Coveralls, Inc