MCPcopy Create free account
hub / github.com/error311/FileRise / buildPreviewUrl

Function buildPreviewUrl

public/js/filePreview.js:49–60  ·  view source on GitHub ↗
(folder, name, sourceId = '')

Source from the content-addressed store, hash-verified

47
48// Build a preview URL that always goes through the API layer (respects ACLs/UPLOAD_DIR)
49export function buildPreviewUrl(folder, name, sourceId = '') {
50 const f = (!folder || folder === '') ? 'root' : String(folder);
51 const params = new URLSearchParams({
52 folder: f,
53 file: name,
54 inline: '1',
55 t: String(Date.now())
56 });
57 const sid = resolvePreviewSourceId(sourceId, f, name);
58 if (sid) params.set('sourceId', sid);
59 return withBase(`/api/file/download.php?${params.toString()}`);
60}
61
62// New: build a download URL (attachment)
63export function buildDownloadUrl(folder, name, sourceId = '') {

Callers 5

editFileFunction · 0.85
menuClickDelegateFunction · 0.85
siblingPreviewUrlFunction · 0.85
previewFileFunction · 0.85
setVideoSrcFunction · 0.85

Calls 3

resolvePreviewSourceIdFunction · 0.85
withBaseFunction · 0.85
setMethod · 0.80

Tested by

no test coverage detected