Changeset c9d48fc in Klonkt


Ignore:
Timestamp:
06/22/2026 01:58:08 PM (3 months ago)
Author:
roboburr <roboburr@…>
Branches:
main
Children:
3bb8719
Parents:
17197a9
Message:

fix(download): /bestand used storage_path (absolute) -> Bad path; now uses m.filename

The path guard rejected the absolute storage_path. Now uses the bare m.filename
+ AUDIO_DIR, just like /audio/stream.

Co-Authored-By: Claude <noreply@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/routes/download.js

    r17197a9 rc9d48fc  
    4444function dlTrack(siteId, id) {
    4545  return db.prepare(
    46     `SELECT t.id, t.title, t.artist, t.cover_url, m.storage_path
     46    `SELECT t.id, t.title, t.artist, t.cover_url, m.storage_path, m.filename
    4747       FROM audio_tracks t JOIN media m ON m.id = t.media_id
    4848      WHERE t.id = ? AND t.site_id = ? AND t.downloadable = 1`
     
    129129    return res.status(403).send('Laat eerst je e-mailadres achter om te downloaden.');
    130130  }
    131   const sp = track.storage_path;
     131  // De speelbare/te-downloaden file = de KALE filename (storage_path is een
     132  // absoluut pad → faalt de slash-guard). Zelfde aanpak als /audio/stream.
     133  const sp = track.filename;
    132134  if (!sp || sp.includes('/') || sp.includes('\\') || sp.includes('..')) return res.status(400).send('Bad path');
    133135  const filePath = path.join(AUDIO_DIR, sp);
Note: See TracChangeset for help on using the changeset viewer.