Accept single snippet photos and derive post IDs from titles

This commit is contained in:
2026-09-19 15:54:33 +03:30
parent 2e90e82502
commit 7c8723d2ad
5 changed files with 77 additions and 8 deletions
+5
View File
@@ -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: