Accept single snippet photos and derive post IDs from titles
This commit is contained in:
@@ -184,6 +184,11 @@ def create_app(data_dir=None, token=None):
|
||||
def upload():
|
||||
kind = "snippet" if request.path == "/api/snippets" else "photo"
|
||||
photos = request.files.getlist("photos")
|
||||
if kind == "snippet" and "photo" in request.files:
|
||||
single = request.files.getlist("photo")
|
||||
if len(single) != 1 or photos:
|
||||
abort(400, "Send one photo, photos, or an archive; do not mix image fields")
|
||||
photos = single
|
||||
archives = request.files.getlist("archive")
|
||||
if archives:
|
||||
if photos or len(archives) != 1:
|
||||
|
||||
Reference in New Issue
Block a user