]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Change name of fields for add video api
authorChocobozzz <florian.bigard@gmail.com>
Fri, 18 Mar 2016 15:44:54 +0000 (16:44 +0100)
committerChocobozzz <florian.bigard@gmail.com>
Fri, 18 Mar 2016 15:44:54 +0000 (16:44 +0100)
client/angular/videos/components/add/videos-add.component.html
client/angular/videos/components/add/videos-add.component.ts
server/controllers/api/v1/videos.js
server/tests/api/checkParams.js
server/tests/api/utils.js

index 4252d7abd81e85edf26a316d52e9fc41387c369a..7336ad0c05886563bab688cf3b75c584749c76e4 100644 (file)
@@ -15,7 +15,7 @@
   <div class="form-group">
     <div class="btn btn-default btn-file">
       <span>Select the video...</span>
-      <input type="file" name="input_video" id="input_video">
+      <input type="file" name="videofile" id="videofile">
     </div>
 
     <span *ngIf="fileToUpload">{{ fileToUpload.name }}</span>
index 9926aed63afe3455f22544e702965784b1e56d13..0004cfa20f8651471dc3351989e7956be41e530c 100644 (file)
@@ -22,7 +22,7 @@ export class VideosAddComponent implements OnInit {
   constructor(private _router: Router, private _elementRef: ElementRef) {}
 
   ngOnInit() {
-    jQuery(this._elementRef.nativeElement).find('#input_video').fileupload({
+    jQuery(this._elementRef.nativeElement).find('#videofile').fileupload({
       url: '/api/v1/videos',
       dataType: 'json',
       singleFileUploads: true,
index 4384724c144b793c7d260facd305e48e8413ad1e..97d3e6b5ad6fa10f0fb8c170d9248fe86130f002 100644 (file)
@@ -35,7 +35,7 @@ const storage = multer.diskStorage({
   }
 })
 
-const reqFiles = multer({ storage: storage }).fields([{ name: 'input_video', maxCount: 1 }])
+const reqFiles = multer({ storage: storage }).fields([{ name: 'videofile', maxCount: 1 }])
 
 router.get('/', cacheMiddleware.cache(false), listVideos)
 router.post('/', reqFiles, reqValidator.videosAdd, cacheMiddleware.cache(false), addVideo)
@@ -50,7 +50,7 @@ module.exports = router
 // ---------------------------------------------------------------------------
 
 function addVideo (req, res, next) {
-  const video_file = req.files.input_video[0]
+  const video_file = req.files.videofile[0]
   const video_infos = req.body
 
   videos.seed(video_file.path, function (err, torrent) {
index b31b0e894fd2caeec21bae3906d6fc616371e9e3..dcc190e97a3cb8bf0e829d97dbd842900aafc963 100644 (file)
@@ -137,7 +137,7 @@ describe('Test parameters validator', function () {
           description: 'my super description'
         }
         const attach = {
-          'input_video': pathUtils.join(__dirname, 'fixtures', 'video_short.webm')
+          'videofile': pathUtils.join(__dirname, 'fixtures', 'video_short.webm')
         }
         makePostRequest(path, data, attach, done)
       })
@@ -148,7 +148,7 @@ describe('Test parameters validator', function () {
           description: 'my super description'
         }
         const attach = {
-          'input_video': pathUtils.join(__dirname, 'fixtures', 'video_short.webm')
+          'videofile': pathUtils.join(__dirname, 'fixtures', 'video_short.webm')
         }
         makePostRequest(path, data, attach, done)
       })
@@ -158,7 +158,7 @@ describe('Test parameters validator', function () {
           name: 'my super name'
         }
         const attach = {
-          'input_video': pathUtils.join(__dirname, 'fixtures', 'video_short.webm')
+          'videofile': pathUtils.join(__dirname, 'fixtures', 'video_short.webm')
         }
         makePostRequest(path, data, attach, done)
       })
@@ -171,7 +171,7 @@ describe('Test parameters validator', function () {
                        'very very very very very very very very very very very very very very very long'
         }
         const attach = {
-          'input_video': pathUtils.join(__dirname, 'fixtures', 'video_short.webm')
+          'videofile': pathUtils.join(__dirname, 'fixtures', 'video_short.webm')
         }
         makePostRequest(path, data, attach, done)
       })
@@ -191,7 +191,7 @@ describe('Test parameters validator', function () {
           description: 'my super description'
         }
         const attach = {
-          'input_video': pathUtils.join(__dirname, '..', 'fixtures', 'video_short_fake.webm')
+          'videofile': pathUtils.join(__dirname, '..', 'fixtures', 'video_short_fake.webm')
         }
         makePostRequest(path, data, attach, done)
       })
@@ -202,12 +202,12 @@ describe('Test parameters validator', function () {
           description: 'my super description'
         }
         const attach = {
-          'input_video': pathUtils.join(__dirname, 'fixtures', 'video_short.webm')
+          'videofile': pathUtils.join(__dirname, 'fixtures', 'video_short.webm')
         }
         makePostRequest(path, data, attach, function () {
-          attach.input_video = pathUtils.join(__dirname, 'fixtures', 'video_short.mp4')
+          attach.videofile = pathUtils.join(__dirname, 'fixtures', 'video_short.mp4')
           makePostRequest(path, data, attach, function () {
-            attach.input_video = pathUtils.join(__dirname, 'fixtures', 'video_short.ogv')
+            attach.videofile = pathUtils.join(__dirname, 'fixtures', 'video_short.ogv')
             makePostRequest(path, data, attach, done, true)
           }, true)
         }, true)
index ea0982e816f86212049b1f157ad57af642813960..1b2f6105949b7f7710988e3e431c247157cc40e5 100644 (file)
@@ -185,7 +185,7 @@ function uploadVideo (url, name, description, fixture, end) {
     .set('Accept', 'application/json')
     .field('name', name)
     .field('description', description)
-    .attach('input_video', pathUtils.join(__dirname, 'fixtures', fixture))
+    .attach('videofile', pathUtils.join(__dirname, 'fixtures', fixture))
     .expect(204)
     .end(end)
 }