PDF Attachment is downloaded instead of opened in Browser

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

PDF Attachment is downloaded instead of opened in Browser

WEKU
Hi guys,

I have installed a new Wiki on a 2012 R2 Windows Server.
I also installed the standard Wiki. Now i have a Problem with PDF attachments.

When I upload the PDF attachment and make a Link with the Admin User the PDF is opened in browser when klicking the link or directly the attachment under the page.

When I upload the PDF attachment with a registered user the PDF is downloaded directly, wether the User is in the XWikiAdminGroup or not.

As browser I use Chrome or IE. Both the same. How can I configure that the PDF is always opened in a browser window?

Thanks in advance.

Best Regards,
WEKU
Reply | Threaded
Open this post in threaded view
|

Re: PDF Attachment is downloaded instead of opened in Browser

DeepakEra
Have you tried PDF Macro ?

Upload PDF document and edit page source you want to view your PDF like this,

{{pdfviewer
file="Link to PDF attachment"/}}
Reply | Threaded
Open this post in threaded view
|

Re: PDF Attachment is downloaded instead of opened in Browser

WEKU
Thanks for your reply,

no thats not that what i meant. Normally a PDF is opened by a browser plugin and shown in a browser page. But when the PDF is uploaded by a normal User and not by the Admin user the file isnt opened in a browser page.

It shouldnt be opened inside the wiki page.
Reply | Threaded
Open this post in threaded view
|

Re: PDF Attachment is downloaded instead of opened in Browser

Clemens Klein-Robbenhaar
In reply to this post by WEKU
On 08/26/2014 10:47 AM, WEKU wrote:

> Hi guys,
>
> I have installed a new Wiki on a 2012 R2 Windows Server.
> I also installed the standard Wiki. Now i have a Problem with PDF
> attachments.
>
> When I upload the PDF attachment and make a Link with the Admin User the PDF
> is opened in browser when klicking the link or directly the attachment under
> the page.
>
> When I upload the PDF attachment with a registered user the PDF is
> downloaded directly, wether the User is in the XWikiAdminGroup or not.
>
> As browser I use Chrome or IE. Both the same. How can I configure that the
> PDF is always opened in a browser window?
>

Can you check with Chrome Developer tools (Network tab) if there is any difference
in the "Content-Type:" Response header between the different PDF's ?
Or maybe there is some other visible difference?

I remember I once had a similar issue, but I cannot remember it now ... and
I cannot reproduce it either. :(

Clemens
_______________________________________________
users mailing list
[hidden email]
http://lists.xwiki.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: PDF Attachment is downloaded instead of opened in Browser

WEKU
I think were on a good way. The opened PDF is Type: application/pdf and the downloaded pdf is shown as Type: text/plain.

What do i have to do, that all pdfs are Type: application/pdf?

Thanks in advance!
Reply | Threaded
Open this post in threaded view
|

Re: PDF Attachment is downloaded instead of opened in Browser

Clemens Klein-Robbenhaar
On 08/26/2014 01:23 PM, WEKU wrote:
> I think were on a good way. The opened PDF is Type: application/pdf and the
> downloaded pdf is shown as Type: text/plain.
>
> What do i have to do, that all pdfs are Type: application/pdf?
>

slowly my memory came back: it is a feature ;)

  http://www.xwiki.org/xwiki/bin/view/ReleaseNotes/ReleaseNotesXWiki52#HChoosingwhichtypesofattachmentscanbedisplayedinline28Security29

It seems in either PDF's are blacklisted in your xwiki.properties, or the blacklist "attachment.download.blacklist" is empty;
in that case you will have to maintain a whitelist (attachment.download.whitelist property)

If you are the main admin, you have "programming rights", and these security checks are bypassed; that is why it works in these cases.

Maybe that explains the issue?
The actual issue is about "displaying inline", which is *not* what you asked, but I see in the code of the DownloadAction that this property fiddles with the "Content-Disposition" header. Not sure why this changes the "Content-Type, however.

Anyway, at least for testing, can you set the attachment.download.blacklist=text/html,text/javascript and make sure the  attachment.download.whitelist property is not set in the xwiki.propertuies, and check if this makes a difference ?

Clemens
_______________________________________________
users mailing list
[hidden email]
http://lists.xwiki.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: PDF Attachment is downloaded instead of opened in Browser

WEKU
Hi Clemens,

thank you very much. It worked.
I activated the attachment.download.blacklist feature and now every PDF is opened in a browser window.
Thats ok for me.

Best regards