mirror of
https://github.com/zoriya/flood.git
synced 2026-06-06 03:56:42 +00:00
fix: /metainfo response code (#740)
This commit is contained in:
@@ -587,8 +587,15 @@ router.get<{hashes: string}>(
|
||||
await fs.promises.access(path.join(sessionDirectory, torrentFileName), fs.constants.R_OK),
|
||||
),
|
||||
);
|
||||
} catch {
|
||||
return res.status(404).json({code: 404, message: 'Failed to access torrent files.'});
|
||||
} catch (e) {
|
||||
const err = e as NodeJS.ErrnoException;
|
||||
if (err.code === 'ENOENT') {
|
||||
return res.status(404).json({code: err.code, message: err.message});
|
||||
}
|
||||
return res.status(500).json({
|
||||
code: err.code,
|
||||
message: `Failed to access torrent files: ${e}`,
|
||||
});
|
||||
}
|
||||
|
||||
if (hashes.length < 2) {
|
||||
|
||||
Reference in New Issue
Block a user