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: handle non-prefix storage case in photo editing

Timothy Yinb61556bfce14
diff --git a/server/api/photos/[photoId]/index.put.ts b/server/api/photos/[photoId]/index.put.ts
index f84b13a1..e9d41e02 100644
--- a/server/api/photos/[photoId]/index.put.ts
+++ b/server/api/photos/[photoId]/index.put.ts
@@ -100,12 +100,10 @@ export default eventHandler(async (event) => {
const normalizedDescription =
payload.description !== undefined ? payload.description.trim() : undefined
const normalizedTags = normalizeTags(payload.tags)
- let pendingReverseGeocode:
- | {
- latitude: number
- longitude: number
- }
- | null = null
+ let pendingReverseGeocode: {
+ latitude: number
+ longitude: number
+ } | null = null
const exifUpdates: Record<string, any> = {}
@@ -168,8 +166,12 @@ export default eventHandler(async (event) => {
}
const updatedBuffer = await readFile(tempFile)
+ const prefix =
+ storageProvider.config && 'prefix' in storageProvider.config
+ ? storageProvider.config.prefix
+ : ''
await storageProvider.create(
- photo.storageKey.replace(storageProvider.config?.prefix || '', ''),
+ photo.storageKey.replace(prefix || '', ''),
updatedBuffer,
)