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

supabase / storage / 29402487719

15 Jul 2026 08:54AM UTC coverage: 50.02% (-29.4%) from 79.38%
29402487719

Pull #1235

github

web-flow
Merge 379605bf4 into 9434eb79c
Pull Request #1235: fix: hoist regex and num parser in x-robots-tag

3416 of 7349 branches covered (46.48%)

Branch coverage included in aggregate %.

6 of 6 new or added lines in 1 file covered. (100.0%)

3851 existing lines in 164 files now uncovered.

6535 of 12545 relevant lines covered (52.09%)

63.44 hits per line

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

53.33
/src/http/plugins/storage.ts
1
import { createStorageBackend, StorageBackendAdapter } from '@storage/backend'
2
import type { Database } from '@storage/database'
3
import { StoragePgDB } from '@storage/database'
4
import { PassThroughLocation, TenantLocation } from '@storage/locator'
5
import { Storage } from '@storage/storage'
6
import fastifyPlugin from 'fastify-plugin'
7
import { getConfig } from '../../config'
8

9
declare module 'fastify' {
10
  interface FastifyRequest {
11
    storage: Storage
12
    backend: StorageBackendAdapter
13
  }
14
}
15

16
const { storageBackendType, storageS3Bucket } = getConfig()
5✔
17

18
const storageBackend = createStorageBackend(storageBackendType)
5✔
19

20
// TenantLocation is immutable so singleton not to allocate per request.
21
const tenantLocation = new TenantLocation(storageS3Bucket)
5✔
22

23
export const storage = fastifyPlugin(
5✔
24
  async function storagePlugin(fastify) {
25
    fastify.decorateRequest('storage')
8✔
26
    fastify.addHook('preHandler', async (request) => {
8✔
UNCOV
27
      const databaseOptions = {
×
28
        tenantId: request.tenantId,
29
        host: request.headers['x-forwarded-host'] as string,
30
        reqId: request.id,
31
        sbReqId: request.sbReqId,
32
        latestMigration: request.latestMigration,
33
      }
34

UNCOV
35
      const database: Database = new StoragePgDB(request.db, databaseOptions)
×
36

UNCOV
37
      const location = request.isIcebergBucket
×
38
        ? new PassThroughLocation(request.internalIcebergBucketName!)
39
        : tenantLocation
40

UNCOV
41
      request.backend = storageBackend
×
UNCOV
42
      request.storage = new Storage(storageBackend, database, location)
×
43
    })
44

45
    fastify.addHook('onClose', async () => {
8✔
46
      storageBackend.close()
8✔
47
    })
48
  },
49
  { name: 'storage-init' }
50
)
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