be4d43105e
Node.js/Express backend + vanilla JS frontend. Features: real-time collaborative whiteboard (SSE), multi-page support, LaTeX formulas, shapes/connectors, coordinate systems, number lines, compass, zoom/pan, Catmull-Rom pencil smoothing, ruler/protractor with rotation & resize controls, minimap navigation overlay, auto-measurements, multi-page thumbnails sidebar, PNG export, page templates. Student/teacher workflows: classes, assignments, library, dashboard. Mobile responsive. SQLite (better-sqlite3). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
16 lines
488 B
JavaScript
16 lines
488 B
JavaScript
/**
|
|
* Multer encodes originalname as latin1 (ISO-8859-1).
|
|
* Browsers send filenames as UTF-8 bytes, so non-ASCII chars get mangled.
|
|
* This middleware re-decodes the bytes back to proper UTF-8.
|
|
*/
|
|
function fixUtf8Name(req, _res, next) {
|
|
if (req.file && req.file.originalname) {
|
|
try {
|
|
req.file.originalname = Buffer.from(req.file.originalname, 'latin1').toString('utf8');
|
|
} catch { /* keep as-is if decoding fails */ }
|
|
}
|
|
next();
|
|
}
|
|
|
|
module.exports = { fixUtf8Name };
|