A music player that connects to your cloud/distributed storage.
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: webdav encoding/decoding issues

+11 -14
+8 -12
src/components/input/webdav/common.js
··· 2 2 import * as URI from "fast-uri"; 3 3 import QS from "query-string"; 4 4 5 + import { safeDecodeURIComponent } from "~/common/utils.js"; 6 + 5 7 import { cachedConsult } from "~/components/input/common.js"; 6 8 import { SCHEME } from "./constants.js"; 7 9 ··· 50 52 [protocol, host] = host.split("://"); 51 53 } 52 54 53 - return URI.serialize({ 54 - scheme: SCHEME, 55 - userinfo: `${encodeURIComponent(server.username)}:${ 56 - encodeURIComponent(server.password) 57 - }`, 58 - host, 59 - path: filePath, 60 - query: QS.stringify({ dir: server.dir, protocol }), 61 - }); 55 + const userinfo = `${encodeURIComponent(server.username)}:${encodeURIComponent(server.password)}`; 56 + const query = QS.stringify({ dir: server.dir, protocol }); 57 + return `${SCHEME}://${userinfo}@${host}${filePath}${query ? `?${query}` : ""}`; 62 58 } 63 59 64 60 /** ··· 280 276 } catch { 281 277 rawPath = href; 282 278 } 283 - const path = decodeURIComponent(rawPath); 279 + const path = safeDecodeURIComponent(rawPath); 284 280 285 281 // Skip the directory entry itself. 286 282 // Normalise both sides to have a leading slash — server hrefs always do, 287 283 // but `dir` may not when the user omitted the leading slash in the form. 288 284 const normPath = path.replace(/\/$/, ""); 289 - const normDir = ("/" + decodeURIComponent(dir).replace(/^\//, "")).replace( 285 + const normDir = ("/" + safeDecodeURIComponent(dir).replace(/^\//, "")).replace( 290 286 /\/$/, 291 287 "", 292 288 ); ··· 298 294 if (isCollection) { 299 295 subdirs.push(rawPath); 300 296 } else { 301 - paths.push(path); 297 + paths.push(rawPath); 302 298 } 303 299 } 304 300
+3 -2
src/components/input/webdav/worker.js
··· 5 5 groupKey, 6 6 isAudioFile, 7 7 } from "~/components/input/common.js"; 8 + import { safeDecodeURIComponent } from "~/common/utils.js"; 8 9 9 10 import { 10 11 buildTrackUrl, ··· 109 110 if (!parsed) return; 110 111 111 112 if (!cache[id]) cache[id] = {}; 112 - cache[id][parsed.path] = track; 113 + cache[id][safeDecodeURIComponent(parsed.path)] = track; 113 114 }); 114 115 }); 115 116 ··· 119 120 let tracks = files 120 121 .filter((path) => isAudioFile(path)) 121 122 .map((path) => { 122 - const cachedTrack = cache[id]?.[path]; 123 + const cachedTrack = cache[id]?.[safeDecodeURIComponent(path)]; 123 124 124 125 const trackId = cachedTrack?.id || TID.now(); 125 126 const stats = cachedTrack?.stats;