Skip to content

dynamic content and type detection problem with URL parameters #46

@drlivingston

Description

@drlivingston

If I have a dynamically generated / custom served PDF (because I have to use URLs that expire and that verify security settings in the session before serving content) I have issues with the type detection:

This works as expected:

http://localhost:8080/Viewer.js/index.html#/test/pdf/demodoc.pdf

This does not work:

http://localhost:8080/Viewer.js/index.html#/test/pdf/demodoc.pdf?foo=bar

This hack with a parameter I don't look at forced on the end does:

http://localhost:8080/Viewer.js/index.html#/test/pdf/demodoc.pdf?foo=bar&type=.pdf

I think the problem is here:

function loadDocument(documentUrl) {
    "use strict";

    if (documentUrl) {
        var extension = documentUrl.split('.').pop(),

this function assumes that there are no parameters

The following might fix this:

function loadDocument(documentUrl) {
    "use strict";

    if (documentUrl) {
        var extension = documentUrl.split('?')[0].split('.').pop(),

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions