Self-hosted personal gallery application with online photo management and albums, supporting Live/Motion Photos, EXIF parsing, geolocation recognition, and an explore map.
TypeScript albumsexif-extractiongeocodinglive-photomotion-photophoto-galleryphoto-sharingwebgl-viewer
fix(s3): object key with no prefix
Timothy Yin5ef28df2817d
diff --git a/server/services/photo/pipeline-async.ts b/server/services/photo/pipeline-async.tsindex 52e72ed0..71622f37 100644--- a/server/services/photo/pipeline-async.ts+++ b/server/services/photo/pipeline-async.ts@@ -11,7 +11,7 @@ import { StorageObject } from '../storage'import { extractExifData, extractPhotoInfo } from '../image/exif'const generatePhotoId = (s3key: string) => {- return path.basename(s3key, path.extname(s3key))+ return path.basename(s3key, path.extname(s3key)).replace(/ /g, '_')}/**diff --git a/server/services/storage/providers/s3.ts b/server/services/storage/providers/s3.tsindex 016547f0..b3012044 100644--- a/server/services/storage/providers/s3.ts+++ b/server/services/storage/providers/s3.ts@@ -67,7 +67,10 @@ export class S3StorageProvider implements StorageProvider {try {const cmd = new PutObjectCommand({Bucket: this.config.bucket,- Key: key,+ Key: `${(this.config.prefix || '').replace(/\/+$/, '')}/${key}`.replace(+ /^\/+/,+ '',+ ),Body: data,ContentType: contentType || 'application/octet-stream',})@@ -168,7 +171,7 @@ export class S3StorageProvider implements StorageProvider {ContentType: options?.contentType || 'application/octet-stream',})- const url = await getSignedUrl(this.client, cmd, {+ const url = await getSignedUrl(this.client, cmd, {expiresIn,// 为了更好的 CORS 支持,添加一些额外参数unhoistableHeaders: new Set(['Content-Type']),