Skip to content

Self-hosted personal gallery application with online photo management and albums, supporting Live/Motion Photos, EXIF parsing, geolocation recognition, and an explore map.

fix: 编辑照片元数据时后台报错 ENOENT

Timothy Yin34026a59175e
diff --git a/.nuxtrc b/.nuxtrc
index 4f03c3fc..1e780800 100644
--- a/.nuxtrc
+++ b/.nuxtrc
@@ -1 +1 @@
-setups.@nuxt/test-utils="4.0.2"
\ No newline at end of file
+setups.@nuxt/test-utils="3.23.0"
\ No newline at end of file
diff --git a/server/api/photos/[photoId]/index.put.ts b/server/api/photos/[photoId]/index.put.ts
index e9d41e02..9d35783a 100644
--- a/server/api/photos/[photoId]/index.put.ts
+++ b/server/api/photos/[photoId]/index.put.ts
@@ -1,4 +1,4 @@
-import { mkdtemp, readFile, rm, writeFile } from 'node:fs/promises'
+import { mkdir, mkdtemp, readFile, rm, writeFile } from 'node:fs/promises'
import { tmpdir } from 'node:os'
import path from 'node:path'
import { z } from 'zod'
@@ -154,7 +154,9 @@ export default eventHandler(async (event) => {
exifUpdates.Rating = payload.rating !== null ? payload.rating : null
}
- const tempDir = await mkdtemp(path.join(tmpdir(), 'cframe-edit-'))
+ const tempRoot = tmpdir()
+ await mkdir(tempRoot, { recursive: true })
+ const tempDir = await mkdtemp(path.join(tempRoot, 'cframe-edit-'))
const ext = path.extname(photo.storageKey) || '.jpg'
const tempFile = path.join(tempDir, `edited${ext}`)
diff --git a/server/services/pipeline-queue/manager.ts b/server/services/pipeline-queue/manager.ts
index e8f19f0e..d2202213 100644
--- a/server/services/pipeline-queue/manager.ts
+++ b/server/services/pipeline-queue/manager.ts
@@ -1,5 +1,5 @@
import type { ConsolaInstance } from 'consola'
-import { mkdtemp, readFile, rm, writeFile } from 'node:fs/promises'
+import { mkdir, mkdtemp, readFile, rm, writeFile } from 'node:fs/promises'
import { tmpdir } from 'node:os'
import path from 'path'
import { asc, desc, eq, sql } from 'drizzle-orm'
@@ -641,7 +641,9 @@ export class QueueManager {
throw new Error(`Photo file ${photo.storageKey} not found in storage`)
}
- const tempDir = await mkdtemp(path.join(tmpdir(), 'cframe-location-'))
+ const tempRoot = tmpdir()
+ await mkdir(tempRoot, { recursive: true })
+ const tempDir = await mkdtemp(path.join(tempRoot, 'cframe-location-'))
const ext = path.extname(photo.storageKey) || '.jpg'
const tempFile = path.join(tempDir, `erase-location${ext}`)