From a13bcbea25f9afdb589d1ad37ae1da4de760e733 Mon Sep 17 00:00:00 2001 From: Luxray5474 Date: Mon, 24 Aug 2020 16:58:33 -0400 Subject: [PATCH] Implement flmt default to creationdate if URL If a URL is given instead of a file, flmt will default to creationdate. This is temporary (?) since we can't easily find flmt from URL. --- client/js/controllers/post_upload_controller.js | 4 +++- server/szurubooru/api/post_api.py | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/client/js/controllers/post_upload_controller.js b/client/js/controllers/post_upload_controller.js index 2ad02afc..4c4ec68f 100644 --- a/client/js/controllers/post_upload_controller.js +++ b/client/js/controllers/post_upload_controller.js @@ -175,9 +175,11 @@ class PostUploadController { // if uploadable.source is ever going to be a valid field (e.g when setting source directly in the upload window) // you'll need to change the line below to `post.source = uploadable.source || uploadable.url;` if (uploadable.url) { + // For now, if the input is a URL, flmt will be same as creation date post.source = uploadable.url; + } else { + post.fileLastModifiedTime = uploadable.file.lastModified; } - post.fileLastModifiedTime = uploadable.file.lastModified; // The client already reads the data anyway, which is convenient return post; } } diff --git a/server/szurubooru/api/post_api.py b/server/szurubooru/api/post_api.py index 9262af56..86c2908c 100644 --- a/server/szurubooru/api/post_api.py +++ b/server/szurubooru/api/post_api.py @@ -89,7 +89,7 @@ def create_post( posts.update_post_flags(post, flags) if ctx.has_param("fileLastModifiedTime"): posts.update_post_file_last_modified_time( - post, ctx.get_as_param("file_last_modified_time") + post, ctx.get_param_as_int("fileLastModifiedTime") ) if ctx.has_file("thumbnail"): posts.update_post_thumbnail(post, ctx.get_file("thumbnail"))