mirror of
https://github.com/taobataoma/meanTorrent.git
synced 2026-05-06 07:35:50 +02:00
add subtitle upload multer config
This commit is contained in:
@@ -39,3 +39,20 @@ module.exports.createUploadFilename = function (req, file, cb) {
|
||||
module.exports.getUploadDestination = function (req, file, cb) {
|
||||
cb(null, config.uploads.torrent.file.dest);
|
||||
};
|
||||
|
||||
module.exports.createUploadSubtitleFilename = function (req, file, cb) {
|
||||
var regex = new RegExp(',', 'g');
|
||||
var filename = file.originalname.replace(regex, ' ');
|
||||
|
||||
if (fs.existsSync(config.uploads.subtitles.file.dest + filename)) {
|
||||
var err = new Error();
|
||||
err.code = 'FILE_ALREADY_EXISTS';
|
||||
cb(err, null);
|
||||
} else {
|
||||
cb(null, filename);
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.getUploadSubtitleDestination = function (req, file, cb) {
|
||||
cb(null, config.uploads.subtitles.file.dest);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user