progress bar + better ui

This commit is contained in:
Ludwig Lehnert
2026-03-27 20:08:40 +01:00
parent 31c7f92d7c
commit 83fbeff16c
8 changed files with 474 additions and 29 deletions

View File

@@ -23,7 +23,6 @@ import {
isValidNodeName,
resolveAdminPath,
safeBaseName,
sanitizeExtension,
sanitizeRelativePath,
} from './files.js';
import {
@@ -264,8 +263,7 @@ export async function uploadFileAction(formData) {
const now = Date.now();
const originalName = safeBaseName(uploadedFile.name, 'upload');
const extension = sanitizeExtension(originalName);
const storedName = `${createRandomId()}${extension}`;
const storedName = createRandomId();
const storedPath = path.join(shareDir, storedName);
const retentionSeconds = parseHours(formData.get('retentionHours'), uploadTtlSeconds);

View File

@@ -53,6 +53,15 @@ export function sanitizeExtension(value) {
return /^\.[a-z0-9]{1,10}$/.test(extension) ? extension : '';
}
export function sharedLinkName(storedName) {
const value = String(storedName || '').trim();
const extension = sanitizeExtension(value);
if (!extension) {
return value;
}
return value.slice(0, -extension.length);
}
export function adminFilesHref(relativePath = '') {
const clean = sanitizeRelativePath(relativePath);
if (!clean) {