プロジェクト

全般

プロフィール

Vote #79021

完了

Remove filename from attachment preview links

Admin Redmine さんが3年以上前に追加. 3年以上前に更新.

ステータス:
Closed
優先度:
通常
担当者:
-
カテゴリ:
Attachments_19
対象バージョン:
開始日:
2022/05/09
期日:
進捗率:

0%

予定工数:
category_id:
19
version_id:
99
issue_org_id:
27822
author_id:
3866
assigned_to_id:
332
comments:
6
status_id:
5
tracker_id:
2
plus1:
0
affected_version:
closed_on:
affected_version_id:
ステータス-->[Closed]

説明

Some of our users reported being confused by the attachment previews. The most common use-case was a variation of:

right-click on the link of the attachment on the issue page,

"save link as" to save the attachment to disk,

send the saved file to a user not on the Redmine.

With the current URL scheme for attachment preview pages (@/attachments/:id/:filename@), when the users click the preview attachment link instead of the download attachment link, the resulting html file still has the @filename@ of the attachment. If the user does not have a look at the attachment before using it for something else, the user might have downloaded the html preview page instead of the attachment itself.


journals

The attached patch changes the URL rendered to preview pages from @/attachments/:id/:filename@ to @/attachments/:id@. Both URLs work before and after the patch, so this will for example not break plugins or links coming from external sites. The links to the preview attachment pages in Redmine will not have the @filename@ in the URL, thus if a user erroneously downloads that instead of the attachment the downloaded file will be called @123.html@ instead of @image.png@ for example.
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
We have to update existing tests to commit this patch.

This is an example:
<pre>
Failure:
ApplicationHelperTest#test_attachment_link_should_link_to_latest_attachment [/Users/maeda/redmines/redmine-trunk/test/helpers/application_helper_test.rb:694]:
--- expected
+++ actual
@@ -1 +1 @@
-"<p><a class=\"attachment\" href=\"/attachments/1100/test.txt\">test.txt</a></p>"
+"<p><a class=\"attachment\" href=\"/attachments/1100\">test.txt</a></p>"
</pre>
--------------------------------------------------------------------------------
Thanks for taking a look at this patch. Attached you may find a diff, which adds the necessary changes to the test suite.
--------------------------------------------------------------------------------
Committed. Thank you for sharing the patches.
--------------------------------------------------------------------------------

Admin Redmine さんが3年以上前に更新

  • カテゴリAttachments_19 にセット
  • 対象バージョン4.0.0_99 にセット

他の形式にエクスポート: Atom PDF

いいね!0
いいね!0