ElkArte Community

Elk Development => Bug Reports => Exterminated Bugs => Topic started by: gevv on March 17, 2018, 04:17:09 pm

Title: Attacment problem (zip, rar)
Post by: gevv on March 17, 2018, 04:17:09 pm
Hi,

I think it was after 1.1.2 update

I've just realized

link click does not download the file

(Link-5650)

 (Link-5648)

(Link-5652)
Title: Re: Attacment problem (zip, rar)
Post by: gevv on March 17, 2018, 04:20:31 pm
elkarte.net  test I added the first message zip file

(Link-5653)
Title: Re: Attacment problem (zip, rar)
Post by: emanuele on March 18, 2018, 06:16:46 pm
Indeed a bug.
I saw the topic yesterday night and today I forgot about it... :-\

Let me check a few moments if I can find the bug and propose a fix.
Ahh... got it: the lightbox tries to show the attachment as an image, but since it is not and Elk sends a download header, it "fails" silently without giving anything to download.

Well, the easiest solution right now is not to "insert" non-image attachments inline.
I'll see if I can figure out a way for the lightbox to "switch" to download when necessary.
Title: Re: Attacment problem (zip, rar)
Post by: radu81 on March 18, 2018, 06:30:21 pm
Strange is that the first time when I opened this topic and clicked on the zip file asked me where to save the file. Then I watched the other attachments in this topic and I clicked again on the zip file I wasn't able to download the file.
Title: Re: Attacment problem (zip, rar)
Post by: emanuele on March 18, 2018, 06:45:04 pm
Interesting @radu81 maybe it was already around before and nobody noticed it? Dunno.
Anyway, this should work: in topic.js (themes/default/scripts) you should have:
Code: [Select]
					setTimeout(function () {
ajaxIndicatorOff();
closeLightbox();
}, 1500);
at line 916.
Change it to:
Code: [Select]
					setTimeout(function () {
ajaxIndicatorOff();
closeLightbox();
window.location = link.href;
}, 1500);
That is probably a good default behaviour: if something fails in showing the URL inside the lightbox, just try the good old download.
Title: Re: Attacment problem (zip, rar)
Post by: radu81 on March 18, 2018, 07:52:39 pm
It works ;)
Title: Re: Attacment problem (zip, rar)
Post by: emanuele on March 19, 2018, 03:40:57 am
This evening I'll push 1.1.3 live here (it was not urgent because anyway we are not in the conditions to trigger the issue), then I'll add this one too.
Title: Re: Attacment problem (zip, rar)
Post by: gevv on March 20, 2018, 06:51:10 am
Hi,

Is there a solution? 

thanks
Title: Re: Attacment problem (zip, rar)
Post by: radu81 on March 20, 2018, 07:14:14 am
Emanuele posted the solution 2 posts above and t works 
Title: Re: Attacment problem (zip, rar)
Post by: gevv on March 20, 2018, 10:10:54 am
Replace topic.js test ok.  click the link and wait for a while to download the file .  How an icon looks instead of "asd"   or file name instead of icon  

 thanks @emanuele

as for me should not be  insert compressed files, only picture files insert


Title: Re: Attacment problem (zip, rar)
Post by: radu81 on March 20, 2018, 03:47:54 pm
Have a look at this https://www.elkarte.net/community/index.php?topic=5120.msg36311#msg36311

you need to edit the topic.js file, search for that part of code and change it like mentioned in the post above. After this edit you can also place inline zip attachments.
Title: Re: Attacment problem (zip, rar)
Post by: emanuele on March 26, 2018, 04:47:32 pm
https://github.com/elkarte/Elkarte/pull/3150/commits/7325891d3ff622972fdb02cc6ae7e031ef573762