mirror of
https://github.com/BobbyWibowo/lolisafe.git
synced 2025-01-19 01:31:34 +00:00
Return 404 for deleted albums
This commit is contained in:
parent
54a262ef95
commit
e56ef97975
@ -106,7 +106,7 @@ albumsController.get = async (req, res, next) => {
|
||||
const identifier = req.params.identifier;
|
||||
if (identifier === undefined) return res.status(401).json({ success: false, description: 'No identifier provided' });
|
||||
|
||||
const album = await db.table('albums').where('identifier', identifier).first();
|
||||
const album = await db.table('albums').where({ identifier, enabled: 1 }).first();
|
||||
if (!album) return res.json({ success: false, description: 'Album not found' });
|
||||
|
||||
const title = album.name;
|
||||
|
@ -8,8 +8,8 @@ routes.get('/a/:identifier', async (req, res, next) => {
|
||||
let identifier = req.params.identifier;
|
||||
if (identifier === undefined) return res.status(401).json({ success: false, description: 'No identifier provided' });
|
||||
|
||||
const album = await db.table('albums').where('identifier', identifier).first();
|
||||
if (!album) return res.json({ success: false, description: 'Album not found' });
|
||||
const album = await db.table('albums').where({ identifier, enabled: 1 }).first();
|
||||
if (!album) return res.status(404).sendFile('404.html', { root: './pages/error/' });
|
||||
|
||||
const files = await db.table('files').select('name').where('albumid', album.id).orderBy('id', 'DESC');
|
||||
let thumb = '';
|
||||
|
Loading…
Reference in New Issue
Block a user