mirror of
https://0xacab.org/jvoisin/mat2-web.git
synced 2025-02-24 00:59:59 -05:00
documented download endpoint
This commit is contained in:
parent
6aa9fa7029
commit
2c1bc2f05a
33
matweb/oas/download.yml
Normal file
33
matweb/oas/download.yml
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
---
|
||||||
|
tags:
|
||||||
|
- "File Download"
|
||||||
|
summary: 'Download a single cleaned file or zip archive containing multiple files'
|
||||||
|
consumes:
|
||||||
|
- "application/json"
|
||||||
|
produces:
|
||||||
|
- "*/*"
|
||||||
|
parameters:
|
||||||
|
- name: "key"
|
||||||
|
in: "path"
|
||||||
|
description: "A key generated for that resource"
|
||||||
|
required: true
|
||||||
|
type: "string"
|
||||||
|
- name: "secret"
|
||||||
|
in: "path"
|
||||||
|
description: "A secret generated for that resource"
|
||||||
|
required: true
|
||||||
|
type: "string"
|
||||||
|
- name: "filename"
|
||||||
|
in: "path"
|
||||||
|
description: "the filename of the cleaned file"
|
||||||
|
required: true
|
||||||
|
type: "string"
|
||||||
|
|
||||||
|
|
||||||
|
responses:
|
||||||
|
200:
|
||||||
|
description: "An object containing all info about the cleaned file"
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/UploadResponse'
|
||||||
|
404:
|
||||||
|
description: "The filename, key or secret are wrong"
|
@ -72,6 +72,7 @@ class APIDownload(Resource):
|
|||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
self.upload_folder = kwargs['upload_folder']
|
self.upload_folder = kwargs['upload_folder']
|
||||||
|
|
||||||
|
@swag_from('./oas/download.yml')
|
||||||
def get(self, key: str, secret: str, filename: str):
|
def get(self, key: str, secret: str, filename: str):
|
||||||
complete_path, filepath = utils.is_valid_api_download_file(filename, key, secret, self.upload_folder)
|
complete_path, filepath = utils.is_valid_api_download_file(filename, key, secret, self.upload_folder)
|
||||||
# Make sure the file is NOT deleted on HEAD requests
|
# Make sure the file is NOT deleted on HEAD requests
|
||||||
|
Loading…
x
Reference in New Issue
Block a user