Trim leading/trailing space in filename format string. Fix #3701
This commit is contained in:
parent
f548efde15
commit
abe8def0f1
2 changed files with 9 additions and 0 deletions
|
@ -2146,6 +2146,8 @@ Zotero.Attachments = new function () {
|
|||
formatString = Zotero.Prefs.get('attachmentRenameTemplate');
|
||||
}
|
||||
|
||||
formatString = formatString.trim();
|
||||
|
||||
const getSlicedCreatorsOfType = (creatorType, slice) => {
|
||||
let creatorTypeIDs;
|
||||
switch (creatorType) {
|
||||
|
|
|
@ -1547,6 +1547,13 @@ describe("Zotero.Attachments", function() {
|
|||
);
|
||||
});
|
||||
|
||||
it("should trim spaces from template string", function () {
|
||||
assert.equal(
|
||||
Zotero.Attachments.getFileBaseNameFromItem(itemBookSection, ' {{ bookTitle case="snake" }} '),
|
||||
'book_title'
|
||||
);
|
||||
});
|
||||
|
||||
it("should convert old attachmentRenameFormatString to use new attachmentRenameTemplate syntax", function () {
|
||||
assert.equal(
|
||||
Zotero.Prefs.convertLegacyAttachmentRenameFormatString('{%c - }{%y - }{%t{50}}'),
|
||||
|
|
Loading…
Reference in a new issue