mirror of
https://github.com/R0m1k3/Socialflow.git
synced 2026-10-24 15:38:10 +02:00
feat: establish server API routes for authentication, user management, and media processing.
This commit is contained in:
1 parent
94429e86df
commit
7e5c73cad9
1 file changed
+4
-3
+4
-3
@@ -999,13 +999,14 @@ export async function registerRoutes(app: Express): Promise<Server> {
|
|||||||
try {
|
try {
|
||||||
console.log(`🎵 Audio saved locally: ${file.originalname} (${(file.size / 1024 / 1024).toFixed(2)} MB)`);
|
console.log(`🎵 Audio saved locally: ${file.originalname} (${(file.size / 1024 / 1024).toFixed(2)} MB)`);
|
||||||
|
|
||||||
// Build a public URL served by Express at /uploads/audio/<filename>
|
// Multer/busboy reçoit le nom en latin1, mais le navigateur l'envoie en UTF-8 → on reconvertit
|
||||||
|
const decodedName = Buffer.from(file.originalname, 'latin1').toString('utf8');
|
||||||
const publicUrl = `/uploads/audio/${file.filename}`;
|
const publicUrl = `/uploads/audio/${file.filename}`;
|
||||||
|
|
||||||
const track = await storage.createAudioTrack({
|
const track = await storage.createAudioTrack({
|
||||||
userId: user.id,
|
userId: user.id,
|
||||||
title: file.originalname.replace(/\.[^/.]+$/, ""),
|
title: decodedName.replace(/\.[^/.]+$/, ""),
|
||||||
fileName: file.originalname,
|
fileName: decodedName,
|
||||||
url: publicUrl,
|
url: publicUrl,
|
||||||
duration: 0,
|
duration: 0,
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in new issue
Block a user