// Where uploaded files live, and how they're served (3.3.0). One folder for saving and serving: // backend/public/uploads, the same from src/ and dist/. Before 3.3.0 the files were served from // "public/uploads" relative to wherever the process was started, so a backend started from // another folder saved a logo in one place and answered 404 for it from another. const path = require('path'); const express = require('express'); const UPLOADS_DIR = path.join(__dirname, '..', '..', 'public', 'uploads'); /** The folder for one kind of upload (e.g. "branding"), made if it isn't there yet. */ function uploadsDir(sub) { const dir = path.join(UPLOADS_DIR, sub); require('fs').mkdirSync(dir, { recursive: true }); return dir; } // Uploaded branding assets can include SVGs, which may embed