mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-25 17:29:24 +00:00
fix(upload): correct .wma MIME type to audio prefix on upload and add tests
This commit is contained in:
@@ -513,7 +513,10 @@ export function FileBrowser({
|
||||
fileCount: 0,
|
||||
type: 'file',
|
||||
status: hasUrl ? 'uploading' : 'error',
|
||||
mediaType: f.file.type || null,
|
||||
mediaType:
|
||||
f.file.name.toLowerCase().endsWith('.wma') && f.file.type?.startsWith('video/')
|
||||
? f.file.type.replace(/^video\//, 'audio/')
|
||||
: f.file.type || null,
|
||||
createdAt: new Date().toISOString(),
|
||||
updatedAt: new Date().toISOString(),
|
||||
}
|
||||
@@ -846,13 +849,17 @@ export function FileBrowser({
|
||||
}
|
||||
const fileWithId = { file, id: ulid() }
|
||||
fileWithIds.push(fileWithId)
|
||||
let mediaType = file.type
|
||||
if (fileName.toLowerCase().endsWith('.wma') && mediaType?.startsWith('video/')) {
|
||||
mediaType = mediaType.replace(/^video\//, 'audio/')
|
||||
}
|
||||
currentLevel.push({
|
||||
name: fileName,
|
||||
size: file.size,
|
||||
type: 'file',
|
||||
id: fileWithId.id,
|
||||
children: [],
|
||||
mediaType: file.type,
|
||||
mediaType,
|
||||
})
|
||||
}
|
||||
filesToUpload = fileWithIds
|
||||
|
||||
@@ -139,7 +139,9 @@ export const longAudioVideoAsset: AssetInfo = {
|
||||
|
||||
export const SAMPLE_AUDIO_URL = '/sample-audio.mp4'
|
||||
export const SAMPLE_AUDIO_DURATION = 3.0
|
||||
export const SAMPLE_AUDIO_COMPUTED_TOTAL_FRAMES = Math.round(SAMPLE_AUDIO_DURATION * SAMPLE_FRAME_RATE)
|
||||
export const SAMPLE_AUDIO_COMPUTED_TOTAL_FRAMES = Math.round(
|
||||
SAMPLE_AUDIO_DURATION * SAMPLE_FRAME_RATE,
|
||||
)
|
||||
|
||||
export const sampleAudioAsset: AssetInfo = {
|
||||
...sampleVideoAsset,
|
||||
|
||||
Reference in New Issue
Block a user