fix(oss): add binary upload route + base64 fallback fix + MIME types

- Add /oss/upload-binary route using busboy for FormData multipart uploads
- Fix parseUploadPayload base64 fallback: strip data:xxx;base64 prefix
  instead of using entire rawData string as base64 (caused 44-byte
  corrupt files when DATA_URL_PATTERN regex did not match)
- Add image/avif, image/heic, image/heif to MIME_EXTENSIONS

Root cause of ecommerce 502: base64 dataUrl not matching regex pattern
caused server to store corrupt 44-byte files on OSS, DashScope could
not read them and returned "image format is illegal" error.
This commit is contained in:
stringadmin
2026-06-02 15:45:29 +08:00
parent 0f8f3825e1
commit 035190420f
3 changed files with 92 additions and 1 deletions
+1
View File
@@ -19,6 +19,7 @@
"dependencies": {
"alipay-sdk": "^4.14.0",
"bcryptjs": "^2.4.3",
"busboy": "^1.6.0",
"cors": "^2.8.5",
"dotenv": "^16.4.5",
"express": "^4.21.0",