Download link - Content Disposition - file save prompt


(Dean Taylor) #1

I believe at one point this worked…

Currently selecting the download link under large images doesn’t cause images to be “downloaded” - missing prompting for saving as a file.

However it should noted that it does work here on meta and try because file downloads are handled via a CDN.

I have looked around and found that it’s even broken on @sam’s blog Discourse install:

The Content Disposition HTTP header appears to be missing


(Sam Saffron) #2

ahhh … I think I know what that is …

@eviltrout if tagger is mounting an engine I found that engines can interfere here … we should debug this.


(Jeff Atwood) #3

Anything we can do here for 1.2 @eviltrout?


(Robin Ward) #4

I just checked locally and the large images downloaded file and had the Content-Disposition header.

Then I went to @Sam’s blog, clicked on the graph on this post and it also downloaded as a file. I checked the headers in Chrome and it too had the Content-Disposition

What am I missing here to reproduce this?


(Sam Saffron) #5

I wonder if this was somewhere down the line fixed, bookmarked will have a look at this


(Dean Taylor) #6

EDIT: Ignore - me - my thinking this problem still exists may be that it’s cached.


(Dean Taylor) #7

OK a bit more testing…

Note the differences between the Download links that work and the ones that don’t (i.e. .png extension).

###Post 1 (doesn’t work as expected)
Post: Live restarts of a supervised unicorn process - ruby - Sam Saffron’s Blog
Download link: http://discuss.samsaffron.com/uploads/default/76/f8b48c825c151f19.png

###Post 2 (does work as expected)
Post: Announcing rubybench.org - ruby - Sam Saffron's Blog
Download link: http://discuss.samsaffron.com/uploads/default/2090e0e885edd6bd40f33e3a8ed0567dfac391e6

###Post 3 (doesn’t work)
Post: Call to Action: Long running Ruby benchmark - ruby - Sam Saffron’s Blog
Download link: http://discuss.samsaffron.com/uploads/default/84/493197bf05a35c45.png

May also be relevant - the ones that work are topic posts by @sam - the one that doesn’t is a reply by another user.

###Reproduction for first Post link


(Sam Saffron) #8

this is somehow related to the Rails Engine being mounted. Its was very hard to debug when I started looking adding it.

You should be able to reproduce this here somehow as well, since we are using akismet. Even if you bypass the cdn for the links

EDIT

@eviltrout header appears to be missing here https://meta.discourse.org//discourse-meta.s3-us-west-1.amazonaws.com/original/3X/d/9/d9988c49657be1d3ade114885f695a1aa25f71ef.gif


(Dean Taylor) #9

Just to say I don’t know what might “mount an engine” - but this occurs on my instance which doesn’t have “tagger”, nor “akismet” but does have the following:


(Sam Saffron) #10

can you temporarily remove all plugins and then check if the issue is still there


(Dean Taylor) #11

Sadly not right now - I need the poll plugin - a few active polls - and this time of day is quite active this forum.


(Sam Saffron) #12

np, I think we have a repro anyway


(Robin Ward) #13

It looks to me like the posts that can’t be downloaded on Sam’s site don’t have the data-download-href attribute. That attribute was added about a year after that post, so I think a rebake will fix it.


(Dean Taylor) #14

I can confirm that a post from “Sep 12, 2014” fails to download as expected and a post from today works as expected on my instance.

Rebaking the individual (previously failing) post fixes the download link for all images in the post.

Looks like it was added here (Oct 15, 2014):
https://github.com/discourse/discourse/commit/31e9cafe0e053d04fce249a4059bc27ed0772c03

So in-terms of rebaking (if you do confirm):

  • Clear instructions to rebake perhaps should be added for the point version upgrade it effects?
  • Rebake all button in the backend (with confirmation).
  • Handling future required rebakes - possible way of flagging upgrades / updates as requiring rebaking posts.

Rebake impact question - I’ve never done a rebake only the baking that was done automatically on forum import.

The baking process at the time of import actually took ~7 days - rebaking worries me as to it’s impact on the forum…
… it continuing to be usable and backups not causing an issue when running for multiple days.


(Jeff Atwood) #15