Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't load blob url with 1.2.7 #164

Closed
smlee opened this issue Sep 27, 2017 · 5 comments
Closed

Doesn't load blob url with 1.2.7 #164

smlee opened this issue Sep 27, 2017 · 5 comments
Assignees
Labels
Milestone

Comments

@smlee
Copy link

smlee commented Sep 27, 2017

I recently updated my package and was going nuts trying to figure out why none of the PDFs were loading. I rolled back to 1.2.6 and works fine. I don't know which dependency is causing this bug.

@VadimDez
Copy link
Owner

What error(s) did you get?

@DHFW
Copy link

DHFW commented Sep 29, 2017

I experienced this too. 1.2.6 works.

@smlee
Copy link
Author

smlee commented Sep 29, 2017

@VadimDez All the PDF that used to show up doesn't show up at all. No errors

@smlee
Copy link
Author

smlee commented Sep 29, 2017

1.2.6 shows up sometimes. Just had to downgrade to 1.2.5. I tried deleting my package-lock.json and node_module folder before that. 1.2.5 works fine for now but I believe I had 1.2.5 installed at the time when I initially started this thread.

Not sure if it's going to help but these are the packages I am using:

  "dependencies": {
    "@angular/animations": "^4.4.3",
    "@angular/cdk": "^2.0.0-beta.11",
    "@angular/common": "^4.4.3",
    "@angular/compiler": "^4.4.3",
    "@angular/core": "^4.4.3",
    "@angular/flex-layout": "2.0.0-beta.8",
    "@angular/forms": "^4.4.3",
    "@angular/http": "^4.4.3",
    "@angular/material": "^2.0.0-beta.11",
    "@angular/platform-browser": "^4.4.3",
    "@angular/platform-browser-dynamic": "^4.4.3",
    "@angular/router": "^4.4.3",
    "angular2-jwt": "^0.2.3",
    "angular2-uuid": "^1.1.1",
    "auth0-js": "^8.10.1",
    "core-js": "^2.5.1",
    "hammerjs": "^2.0.8",
    "html2canvas": "^0.5.0-beta4",
    "jsonfn": "^0.31.0",
    "lodash": "^4.17.4",
    "moment": "^2.18.1",
    "ng2-pdf-viewer": "1.2.5",
    "ng2-responsive": "^0.8.4",
    "rxjs": "^5.4.3",
    "ts-helpers": "^1.1.2",
    "zone.js": "^0.8.17"
  },
  "devDependencies": {
    "@angular/cli": "^1.4.3",
    "@angular/compiler-cli": "^4.4.3",
    "@types/auth0-js": "^8.6.3",
    "@types/html2canvas": "^0.5.35",
    "@types/jasmine": "^2.6.0",
    "@types/lodash": "^4.14.76",
    "@types/node": "^8.0.31",
    "codelyzer": "^3.2.0",
    "jasmine-core": "^2.8.0",
    "jasmine-spec-reporter": "^4.2.1",
    "karma": "1.7.0",
    "karma-chrome-launcher": "^2.2.0",
    "karma-cli": "^1.0.1",
    "karma-jasmine": "^1.1.0",
    "karma-remap-istanbul": "^0.6.0",
    "protractor": "~5.1.2",
    "ts-node": "3.0.6",
    "tslint": "^5.7.0",
    "typescript": "~2.3.4"
  }
}

This is how the blob is retrieved:

getTemplateDoc(templateId: string, token: string, file: boolean) {
    let requestUrl = this.backendUrl + `/liveview/${templateId}/token/${token}`;
    let responseType = ResponseContentType.Json;
    if (file) {
      requestUrl += '?file=true';
      responseType = ResponseContentType.Blob;
    }
    return new Promise<any>((resolve, reject) => {
      this.http.get(requestUrl, {responseType: responseType})
        .toPromise()
        .then(res => {
          if (file) {
            const pdfUrl = URL.createObjectURL(res.blob());
            resolve(pdfUrl);
          } else {
            resolve(res.json());
          }
        })
        .catch(err => {
          return reject(err);
        })
    })
  }

@VadimDez VadimDez self-assigned this Sep 29, 2017
@VadimDez VadimDez added the bug label Sep 29, 2017
@VadimDez VadimDez added this to the 2.0.0 milestone Sep 29, 2017
@VadimDez
Copy link
Owner

fixed in 2.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants