Skip to content

Commit c5177e1

Browse files
committed
check whether /data is writeable
1 parent f17f562 commit c5177e1

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

app/routes/resources+/images.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { promises as fs } from 'node:fs'
1+
import { promises as fs, constants } from 'node:fs'
22
import { invariantResponse } from '@epic-web/invariant'
33
import { getImgResponse } from 'openimg/node'
44
import { getDomainUrl } from '#app/utils/misc.tsx'
@@ -12,12 +12,12 @@ async function getCacheDir() {
1212

1313
let dir = './tests/fixtures/openimg'
1414
if (process.env.NODE_ENV === 'production') {
15-
const exists = await fs
16-
.access('/data')
15+
const isAccessible = await fs
16+
.access('/data', constants.W_OK)
1717
.then(() => true)
1818
.catch(() => false)
1919

20-
if (exists) {
20+
if (isAccessible) {
2121
dir = '/data/images'
2222
}
2323
}

0 commit comments

Comments
 (0)