From f311062b5a31057a24d337112499fe999b124980 Mon Sep 17 00:00:00 2001 From: j Date: Fri, 29 Nov 2019 20:48:40 +0100 Subject: [PATCH 1/2] better function name --- static/js/document.js | 4 ++-- static/js/utils.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/static/js/document.js b/static/js/document.js index 1f517fab..22fee0a0 100644 --- a/static/js/document.js +++ b/static/js/document.js @@ -66,7 +66,7 @@ pandora.ui.document = function() { ? pandora.user.ui.documents[item.id].position : 1, url: '/documents/' + item.id + '/' - + pandora.safePDFName(item.title + '.' + item.extension), + + pandora.safeDocumentName(item.title) + '.' + item.extension, width: that.width(), zoom: 'fit' }) @@ -80,7 +80,7 @@ pandora.ui.document = function() { imageHeight: item.dimensions[1], imagePreviewURL: pandora.getMediaURL('/documents/' + item.id + '/256p.jpg?' + item.modified), imageURL: pandora.getMediaURL('/documents/' + item.id + '/' - + pandora.safePDFName(item.title) + '.' + item.extension + '?' + item.modified), + + pandora.safeDocumentName(item.title) + '.' + item.extension + '?' + item.modified), imageWidth: item.dimensions[0], width: that.width() }).css({ diff --git a/static/js/utils.js b/static/js/utils.js index c3978345..a4de127d 100644 --- a/static/js/utils.js +++ b/static/js/utils.js @@ -2640,7 +2640,7 @@ pandora.openURL = function(url) { } }; -pandora.safePDFName = function(name) { +pandora.safeDocumentName = function(name) { name = name.replace('?', '_').replace('#', '_'); return name; }; From 2f7e8a078038e672e480c25463cde7bbd0ce47b5 Mon Sep 17 00:00:00 2001 From: j Date: Sun, 1 Dec 2019 01:20:58 +0100 Subject: [PATCH 2/2] year db is only 4 chars long --- pandora/item/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora/item/models.py b/pandora/item/models.py index f625fb80..ba98cb1e 100644 --- a/pandora/item/models.py +++ b/pandora/item/models.py @@ -1047,7 +1047,7 @@ class Item(models.Model): value = len(value) set_value(s, name, value) elif sort_type == 'year': - value = self.get(source) + value = self.get(source)[:4] set_value(s, name, value) elif sort_type == 'date': value = value_ = self.get(source)