diff options
author | Rigel Kent <sendmemail@rigelk.eu> | 2020-11-23 10:45:42 +0100 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2020-12-03 10:15:49 +0100 |
commit | d4132d3f56b392a2e4e632db59e6644e4851228e (patch) | |
tree | be903734aa9ce3d669c40656a0f81bd3e9c7978c /support | |
parent | 4a54a93941d1c095bf249331df799c51e39c3774 (diff) | |
download | PeerTube-d4132d3f56b392a2e4e632db59e6644e4851228e.tar.gz PeerTube-d4132d3f56b392a2e4e632db59e6644e4851228e.tar.zst PeerTube-d4132d3f56b392a2e4e632db59e6644e4851228e.zip |
more explicit error messages for file uploads
Diffstat (limited to 'support')
-rw-r--r-- | support/doc/api/openapi.yaml | 16 | ||||
-rw-r--r-- | support/nginx/peertube | 25 |
2 files changed, 27 insertions, 14 deletions
diff --git a/support/doc/api/openapi.yaml b/support/doc/api/openapi.yaml index 6dd51ec7c..4f9bca729 100644 --- a/support/doc/api/openapi.yaml +++ b/support/doc/api/openapi.yaml | |||
@@ -972,6 +972,14 @@ paths: | |||
972 | application/json: | 972 | application/json: |
973 | schema: | 973 | schema: |
974 | $ref: '#/components/schemas/Avatar' | 974 | $ref: '#/components/schemas/Avatar' |
975 | '413': | ||
976 | description: image file too large | ||
977 | headers: | ||
978 | X-File-Maximum-Size: | ||
979 | schema: | ||
980 | type: string | ||
981 | format: Nginx size | ||
982 | description: Maximum file size for the avatar | ||
975 | requestBody: | 983 | requestBody: |
976 | content: | 984 | content: |
977 | multipart/form-data: | 985 | multipart/form-data: |
@@ -1308,6 +1316,14 @@ paths: | |||
1308 | description: user video quota is exceeded with this video | 1316 | description: user video quota is exceeded with this video |
1309 | '408': | 1317 | '408': |
1310 | description: upload has timed out | 1318 | description: upload has timed out |
1319 | '413': | ||
1320 | description: video file too large | ||
1321 | headers: | ||
1322 | X-File-Maximum-Size: | ||
1323 | schema: | ||
1324 | type: string | ||
1325 | format: Nginx size | ||
1326 | description: Maximum file size for the video | ||
1311 | '422': | 1327 | '422': |
1312 | description: invalid input file | 1328 | description: invalid input file |
1313 | requestBody: | 1329 | requestBody: |
diff --git a/support/nginx/peertube b/support/nginx/peertube index f1ef4ccd1..641d254af 100644 --- a/support/nginx/peertube +++ b/support/nginx/peertube | |||
@@ -62,9 +62,9 @@ server { | |||
62 | ## | 62 | ## |
63 | 63 | ||
64 | location @api { | 64 | location @api { |
65 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | 65 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; |
66 | proxy_set_header Host $host; | 66 | proxy_set_header Host $host; |
67 | proxy_set_header X-Real-IP $remote_addr; | 67 | proxy_set_header X-Real-IP $remote_addr; |
68 | 68 | ||
69 | client_max_body_size 100k; # default is 1M | 69 | client_max_body_size 100k; # default is 1M |
70 | 70 | ||
@@ -81,26 +81,23 @@ server { | |||
81 | } | 81 | } |
82 | 82 | ||
83 | location = /api/v1/users/me/avatar/pick { | 83 | location = /api/v1/users/me/avatar/pick { |
84 | limit_except POST { deny all; } | 84 | limit_except POST HEAD { deny all; } |
85 | 85 | ||
86 | client_max_body_size 2M; # default is 1M | 86 | client_max_body_size 2M; # default is 1M |
87 | add_header X-File-Maximum-Size 2M always; # inform backend of the set value in bytes | ||
87 | 88 | ||
88 | try_files /dev/null @api; | 89 | try_files /dev/null @api; |
89 | } | 90 | } |
90 | 91 | ||
91 | location = /api/v1/videos/upload { | 92 | location = /api/v1/videos/upload { |
92 | limit_except POST { deny all; } | 93 | limit_except POST HEAD { deny all; } |
93 | 94 | ||
94 | # This is the maximum upload size, which roughly matches the maximum size of a video file | 95 | # This is the maximum upload size, which roughly matches the maximum size of a video file. |
95 | # you can send via the API or the web interface. By default we set it to 8GB, but administrators | ||
96 | # can increase or decrease the limit. Currently there's no way to communicate this limit | ||
97 | # to users automatically, so you may want to leave a note in your instance 'about' page if | ||
98 | # you change this. | ||
99 | # | ||
100 | # Note that temporary space is needed equal to the total size of all concurrent uploads. | 96 | # Note that temporary space is needed equal to the total size of all concurrent uploads. |
101 | # This data gets stored in /var/lib/nginx by default, so you may want to put this directory | 97 | # This data gets stored in /var/lib/nginx by default, so you may want to put this directory |
102 | # on a dedicated filesystem. | 98 | # on a dedicated filesystem. |
103 | client_max_body_size 8G; # default is 1M | 99 | client_max_body_size 8G; # default is 1M |
100 | add_header X-File-Maximum-Size 8G always; # inform backend of the set value in bytes | ||
104 | 101 | ||
105 | try_files /dev/null @api; | 102 | try_files /dev/null @api; |
106 | } | 103 | } |