diff options
Diffstat (limited to 'server')
-rw-r--r-- | server/controllers/api/v1/videos.js | 2 | ||||
-rw-r--r-- | server/initializers/checker.js | 2 | ||||
-rw-r--r-- | server/initializers/constants.js | 2 | ||||
-rw-r--r-- | server/models/video.js | 4 | ||||
-rw-r--r-- | server/tests/api/single-pod.js | 11 |
5 files changed, 14 insertions, 7 deletions
diff --git a/server/controllers/api/v1/videos.js b/server/controllers/api/v1/videos.js index d633af76d..ee47ce7ac 100644 --- a/server/controllers/api/v1/videos.js +++ b/server/controllers/api/v1/videos.js | |||
@@ -25,7 +25,7 @@ const Video = mongoose.model('Video') | |||
25 | // multer configuration | 25 | // multer configuration |
26 | const storage = multer.diskStorage({ | 26 | const storage = multer.diskStorage({ |
27 | destination: function (req, file, cb) { | 27 | destination: function (req, file, cb) { |
28 | cb(null, constants.CONFIG.STORAGE.UPLOAD_DIR) | 28 | cb(null, constants.CONFIG.STORAGE.VIDEOS_DIR) |
29 | }, | 29 | }, |
30 | 30 | ||
31 | filename: function (req, file, cb) { | 31 | filename: function (req, file, cb) { |
diff --git a/server/initializers/checker.js b/server/initializers/checker.js index 85e9bc98b..0bc5df92f 100644 --- a/server/initializers/checker.js +++ b/server/initializers/checker.js | |||
@@ -17,7 +17,7 @@ function checkConfig () { | |||
17 | const required = [ 'listen.port', | 17 | const required = [ 'listen.port', |
18 | 'webserver.https', 'webserver.host', 'webserver.port', | 18 | 'webserver.https', 'webserver.host', 'webserver.port', |
19 | 'database.host', 'database.port', 'database.suffix', | 19 | 'database.host', 'database.port', 'database.suffix', |
20 | 'storage.certs', 'storage.uploads', 'storage.logs', 'storage.thumbnails' | 20 | 'storage.certs', 'storage.videos', 'storage.logs', 'storage.thumbnails' |
21 | ] | 21 | ] |
22 | const miss = [] | 22 | const miss = [] |
23 | 23 | ||
diff --git a/server/initializers/constants.js b/server/initializers/constants.js index fb1cbc5f3..f77c4948f 100644 --- a/server/initializers/constants.js +++ b/server/initializers/constants.js | |||
@@ -38,7 +38,7 @@ const CONFIG = { | |||
38 | STORAGE: { | 38 | STORAGE: { |
39 | CERT_DIR: path.join(__dirname, '..', '..', config.get('storage.certs')), | 39 | CERT_DIR: path.join(__dirname, '..', '..', config.get('storage.certs')), |
40 | LOG_DIR: path.join(__dirname, '..', '..', config.get('storage.logs')), | 40 | LOG_DIR: path.join(__dirname, '..', '..', config.get('storage.logs')), |
41 | UPLOAD_DIR: path.join(__dirname, '..', '..', config.get('storage.uploads')), | 41 | VIDEOS_DIR: path.join(__dirname, '..', '..', config.get('storage.videos')), |
42 | THUMBNAILS_DIR: path.join(__dirname, '..', '..', config.get('storage.thumbnails')), | 42 | THUMBNAILS_DIR: path.join(__dirname, '..', '..', config.get('storage.thumbnails')), |
43 | TORRENTS_DIR: path.join(__dirname, '..', '..', config.get('storage.torrents')) | 43 | TORRENTS_DIR: path.join(__dirname, '..', '..', config.get('storage.torrents')) |
44 | }, | 44 | }, |
diff --git a/server/models/video.js b/server/models/video.js index 1feefe24f..05c4f51cb 100644 --- a/server/models/video.js +++ b/server/models/video.js | |||
@@ -94,7 +94,7 @@ VideoSchema.pre('save', function (next) { | |||
94 | const tasks = [] | 94 | const tasks = [] |
95 | 95 | ||
96 | if (video.isOwned()) { | 96 | if (video.isOwned()) { |
97 | const videoPath = pathUtils.join(constants.CONFIG.STORAGE.UPLOAD_DIR, video.filename) | 97 | const videoPath = pathUtils.join(constants.CONFIG.STORAGE.VIDEOS_DIR, video.filename) |
98 | this.podUrl = constants.CONFIG.WEBSERVER.URL | 98 | this.podUrl = constants.CONFIG.WEBSERVER.URL |
99 | 99 | ||
100 | tasks.push( | 100 | tasks.push( |
@@ -258,7 +258,7 @@ function removeThumbnail (video, callback) { | |||
258 | } | 258 | } |
259 | 259 | ||
260 | function removeFile (video, callback) { | 260 | function removeFile (video, callback) { |
261 | fs.unlink(constants.CONFIG.STORAGE.UPLOAD_DIR + video.filename, callback) | 261 | fs.unlink(constants.CONFIG.STORAGE.VIDEOS_DIR + video.filename, callback) |
262 | } | 262 | } |
263 | 263 | ||
264 | // Maybe the torrent is not seeded, but we catch the error to don't stop the removing process | 264 | // Maybe the torrent is not seeded, but we catch the error to don't stop the removing process |
diff --git a/server/tests/api/single-pod.js b/server/tests/api/single-pod.js index 623a1a6a3..3125312ca 100644 --- a/server/tests/api/single-pod.js +++ b/server/tests/api/single-pod.js | |||
@@ -245,11 +245,18 @@ describe('Test a single pod', function () { | |||
245 | videosUtils.removeVideo(server.url, server.accessToken, videoId, function (err) { | 245 | videosUtils.removeVideo(server.url, server.accessToken, videoId, function (err) { |
246 | if (err) throw err | 246 | if (err) throw err |
247 | 247 | ||
248 | fs.readdir(pathUtils.join(__dirname, '../../../test1/uploads/'), function (err, files) { | 248 | fs.readdir(pathUtils.join(__dirname, '../../../test1/videos/'), function (err, files) { |
249 | if (err) throw err | 249 | if (err) throw err |
250 | 250 | ||
251 | expect(files.length).to.equal(0) | 251 | expect(files.length).to.equal(0) |
252 | done() | 252 | |
253 | fs.readdir(pathUtils.join(__dirname, '../../../test1/thumbnails/'), function (err, files) { | ||
254 | if (err) throw err | ||
255 | |||
256 | expect(files.length).to.equal(0) | ||
257 | |||
258 | done() | ||
259 | }) | ||
253 | }) | 260 | }) |
254 | }) | 261 | }) |
255 | }) | 262 | }) |