progress bar + better ui
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user