No Attachements after update 2.5.0 -> 4.0.4

Added by Klaus Friese 3 months ago

Hi,

I just updated my redmine installation - I made a new redmine 4.0.4 installation, copied all attachements to the new folder, copied the old database and I made the database update.
I can log in now, I see all old tickets and I see the attachements listed in the ticket. But the link to the attachement is empty.

Old redmine:

<a href="/redmine/attachments/download/9727/Bildschirmfoto%202020-03-31%20um%2012.01.32.png" class="icon icon-attachment">Bildschirmfoto 2020-03-31 um 12.01.32.png</a>

New redmine:

<a class="icon icon-attachment" href="/redmine/attachments/9727">Bildschirmfoto 2020-03-31 um 12.01.32.png</a>

The new link ends after the attachement id. The download icon works:

This is for old and for new tickets the same. How can I fix this?

Thanks
KLaus

rdmn.png (12.5 KB)

Replies (5)

RE: No Attachements after update 2.5.0 -> 4.0.4 - Added by Klaus Friese 3 months ago

Additional info #1

The chrome console shows this message:

4939:1 [DOM] Found 2 elements with non-unique id #: (More info: https://goo.gl/9p2vKq) <input type=​"text" name id value=​"Bildschirmfoto 2020-03-31 um 12.01.32.png" class=​"icon icon-attachment filename" disabled=​"disabled">​ <input type=​"text" name id value=​"Bildschirmfoto 2020-03-31 um 12.02.43.png" class=​"icon icon-attachment filename" disabled=​"disabled">​

Additional info #2

The code to display the attachements is in app/views/attachments/_links.html.erb:

<td>
    <%= link_to_attachment attachment, class: 'icon icon-attachment' -%>
    <span class="size">(<%= number_to_human_size attachment.filesize %>)</span>
    <%= link_to_attachment attachment, class: 'icon-only icon-download', title: l(:button_download), download: true -%>
  </td>

When I add the , download: true from the second link I see the filename in the link. But the image is not displayed in the browser, it's downloaded to the disk

RE: No Attachements after update 2.5.0 -> 4.0.4 - Added by Liane Hampe 3 months ago

Hi Klaus,

you should have two links in your ticket when it has files attached. The first link looks like that:

<a class="icon icon-attachment" href="/attachments/229">logo.png</a> 

When you click this link you will redirected to a page which displays your attachment (AttachmentsController#show).

The other link looks like that:

<a class="icon-only icon-download" title="Herunterladen" href="/attachments/download/229/logo.png">logo.png</a>

It comes along with the download icon and will download the file to disk.

This is how attachments are displayed in Redmine 4.0.4. It is different from from Redmine 2.5.0.

Therefore, there should be nothing to fix. In either case you are able to download your file. Or didn't I get your problem?

Best, Liane

Redmine 4.0.4: See https://www.redmine.org/projects/redmine/repository/entry/tags/4.0.4/app/views/attachments/_links.html.erb.

Redmine 2.5.0: See https://www.redmine.org/projects/redmine/repository/entry/tags/2.5.0/app/views/attachments/_links.html.erb.

RE: No Attachements after update 2.5.0 -> 4.0.4 - Added by Klaus Friese 3 months ago

Hello Liane,

I see the links exactly in the form you posted - but the redirect to the AttachmentsController#show didn't work here.

And this:

<a class="icon icon-attachment" href="/attachments/229">logo.png</a> 

isn't a full html link, it doesn't contain the file name. The href points to the directory /attachments/229 - how does this work? Javascript?

Thanks
Klaus

RE: No Attachements after update 2.5.0 -> 4.0.4 - Added by Klaus Friese 3 months ago

Aaah - the problem is on the next page which shows the attachement - the path is

/redmine/redmine/attachments/download/9727/Bildschirmfoto%202020-03-31%20um%2012.01.32.png

there...

(1-5/5)