feat(builder): add mp4 extension support for Live Photos in storage providers (#218)

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
This commit is contained in:
SuQingyao
2026-01-22 17:41:16 +08:00
committed by GitHub
parent 76b7d47acd
commit a93904686e
4 changed files with 14 additions and 10 deletions

View File

@@ -536,7 +536,7 @@ export class B2StorageProvider implements StorageProvider {
const ext = path.extname(file.key).toLowerCase() const ext = path.extname(file.key).toLowerCase()
if (SUPPORTED_FORMATS.has(ext)) { if (SUPPORTED_FORMATS.has(ext)) {
imageFile = file imageFile = file
} else if (ext === '.mov') { } else if (ext === '.mov' || ext === '.mp4') {
videoFile = file videoFile = file
} }
} }

View File

@@ -390,8 +390,8 @@ export class GitHubStorageProvider implements StorageProvider {
if (SUPPORTED_FORMATS.has(ext)) { if (SUPPORTED_FORMATS.has(ext)) {
imageFile = file imageFile = file
} }
// 检查是否为 .mov 视频文件 // 检查是否为 .mov 或 .mp4 视频文件
else if (ext === '.mov') { else if (ext === '.mov' || ext === '.mp4') {
videoFile = file videoFile = file
} }
} }

View File

@@ -353,12 +353,16 @@ export class LocalStorageProvider implements StorageProvider {
const baseName = path.parse(obj.key).name const baseName = path.parse(obj.key).name
const dirName = path.dirname(obj.key) const dirName = path.dirname(obj.key)
// 查找对应的 .mov 文件 // 查找对应的 .mov 或 .mp4 文件
const videoKey = path.join(dirName, `${baseName}.mov`).replaceAll('\\', '/') const videoExtensions = ['.mov', '.mp4']
for (const videoExt of videoExtensions) {
const videoKey = path.join(dirName, `${baseName}${videoExt}`).replaceAll('\\', '/')
const videoObj = fileMap.get(videoKey.toLowerCase()) const videoObj = fileMap.get(videoKey.toLowerCase())
if (videoObj) { if (videoObj) {
livePhotos.set(obj.key, videoObj) livePhotos.set(obj.key, videoObj)
break
}
} }
} }
}) })

View File

@@ -287,8 +287,8 @@ export class S3StorageProvider implements StorageProvider {
if (SUPPORTED_FORMATS.has(ext)) { if (SUPPORTED_FORMATS.has(ext)) {
imageFile = file imageFile = file
} }
// 检查是否为 .mov 视频文件 // 检查是否为 .mov 或 .mp4 视频文件
else if (ext === '.mov') { else if (ext === '.mov' || ext === '.mp4') {
videoFile = file videoFile = file
} }
} }