Use {title} - {authors} as the default download template
This is Calibre's default. An empty template now restores the default.
This commit is contained in:
@@ -142,7 +142,7 @@ def test_download_builds_from_stored_chapters_without_changing_them(client, stor
|
||||
response = client.get(f"/api/stories/{sid}/epub")
|
||||
assert response.status_code == 200
|
||||
assert response.data.startswith(b"PK")
|
||||
assert "filename=A_B.epub" in response.headers["Content-Disposition"]
|
||||
assert 'filename="A_B - Writer.epub"' in response.headers["Content-Disposition"]
|
||||
assert o.store.revision_html(cid, 1) == original
|
||||
response.close()
|
||||
|
||||
@@ -166,11 +166,12 @@ def test_download_template_names_the_file(client, story):
|
||||
name = download_name(client, sid)
|
||||
assert 'filename="Cafe - 77.epub"' in name and "filename*=UTF-8''Caf%C3%A9%20-%2077.epub" in name
|
||||
# A template with folders gives the name of the file alone.
|
||||
client.put("/api/settings", json={"download_template": "{author_sort}/{title} - {authors}"}, headers=H)
|
||||
client.put("/api/settings", json={"download_template": "{author_sort}/{title}"}, headers=H)
|
||||
assert "filename*=UTF-8''Caf%C3%A9.epub" in download_name(client, sid)
|
||||
# An empty template restores the default.
|
||||
saved = client.put("/api/settings", json={"download_template": " "}, headers=H).json
|
||||
assert saved["download_template"] == "{title} - {authors}"
|
||||
assert "filename*=UTF-8''Caf%C3%A9%20-%20Ann%20Writer.epub" in download_name(client, sid)
|
||||
# Without a template, the name is the title of the story, with its article in front.
|
||||
assert client.put("/api/settings", json={"download_template": ""}, headers=H).json["download_template"] == ""
|
||||
assert 'filename="The Book.epub"' in download_name(client, sid)
|
||||
|
||||
|
||||
def test_download_template_that_fails_gives_the_title(client, story, caplog):
|
||||
|
||||
Reference in New Issue
Block a user