mirror of
https://github.com/NeteaseCloudMusicApiEnhanced/api-enhanced.git
synced 2026-10-20 14:41:23 +08:00
fix(upload): 修复文件上传功能中的路径替换和临时文件支持
- 将单个斜杠替换改为全局正则替换以正确处理所有路径分隔符 - 移除未使用的 crypto 模块引入 - 添加对临时文件上传的支持,使用 fs 模块读取临时文件 - 动态设置 Content-Type 头部,优先使用文件的 mimetype 属性 - 重构多处文件上传逻辑以支持流式读取大文件 - 优化分片上传时的文件大小获取方式
This commit is contained in:
@@ -38,7 +38,7 @@ module.exports = async (query, request) => {
|
||||
}
|
||||
}
|
||||
|
||||
const objectKey = tokenRes.body.result.objectKey.replace('/', '%2F')
|
||||
const objectKey = tokenRes.body.result.objectKey.replace(/\//g, '%2F')
|
||||
let lbs
|
||||
try {
|
||||
lbs = (
|
||||
@@ -87,7 +87,7 @@ module.exports = async (query, request) => {
|
||||
headers: {
|
||||
'x-nos-token': tokenRes.body.result.token,
|
||||
'Content-MD5': query.songFile.md5,
|
||||
'Content-Type': 'audio/mpeg',
|
||||
'Content-Type': query.songFile.mimetype || 'audio/mpeg',
|
||||
'Content-Length': String(query.songFile.size),
|
||||
},
|
||||
data: uploadData,
|
||||
|
||||
Reference in New Issue
Block a user