Downloading from object URL always fails the first time in Firefox - firefox

When opening an object URL in Firefox the file's content is correctly displayed (in the PDF viewer), but "Save page as..." cannot download the blob. The download list in Firefox lists the file as "failed". Clicking on "retry" is successful.
The same approach works successfully in Chrome.
There's no backend involved (at this point). The blob is correctly retrieved in the frontend and displayed, but only on retry is able to download.
The object URL hasn't been revoked (and I can still see an entry in the session storage for the blob. That it always seems to work the second time seems to point to a timing problem to me, but I wouldn't know where to see what failed here.
window.open(URL.createObjectURL(blob))
where the blob was created from the backend's content using Angular's HttpClient:
getContentFileById(id: string): Observable<Blob> {
return this.http.get(`${this.documentUrl}/${id}/content`, {
responseType: 'blob'
});
}
This is both with current Firefox (78.0.2) and Firefox Developer Edition (79.0b9) on macOS Catalina (10.15.5).
It occurs with a file that had the original content disposition attachment or inline although I suspects that's lost anyways when it's converted to a blob.
UPDATE:
Here's a simplified minimal example, where I see the same behavior. I couldn't figure out how to create a Blob directly from an ASCII binary representation, so the example uses a base64-based string. The basic idea to open a created object URL remains the same though:
http://jsfiddle.net/4m8onzu6/9/
Unfortunately this example only opens as PDF file in Firefox, while my actual code also works in Chrome...
I noticed that selecting the normal download button (which most users probably use) works. It's only when you try "Save Page As..." that it first fails, but can download the file on clicking "Retry" in the Downloads list...

Related

Firefox add-on devtools logs don't show object keys/values

I'm currently developing a Firefox add-on and I noticed some logging issues in the add-on devtools (for the background script) page. Whenever I'm trying to console.log some object, I don't see any keys or values of this object in the console. There's also no way to "expand" the object like I can in the "regular" (not for an add-on) Firefox browser console.
So, if I e.g. open the add-on devtools and type console.log({ test: "test" }), I only do get "Object { }" as an output:
If I try to log an error I do get a similar result (I can e.g. still log err.message):
try {
throw new Error("");
} catch (err) {
console.log(err);
}
Since I'm currently developing the add-on locally, I'm using web-ext to launch and watch the add-on. web-ext run is essentially launching Firefox without any profile which I thought may explain the difference compared to a regular Firefox browser console.
However, even if I load the add-on in my normal Firefox profile (load temporary add-on), I do see the same behavior for any add-on devtools console.
Is there any setting in the Firefox (add-on) console (or in my preferences) that I can use to log the whole object like it does in the normal Firefox console, e.g. if I open devtools for a regular webpage:
It's hard to tell what's going on without seeing the relevant code for your Firefox add-on, but I have a hunch that this is happening because of reference changes in your script.
In Javascript, an object is actually a reference to a location in memory. So when you run console.log(obj), and that object is modified before you access the console, then it may show up as empty (i.e. because the value being referenced has changed).
I would make sure that the object that you are trying to log is not modified after you log it. If there are any other objects based on the one that you are trying to log, changes to them may also cause your initial object to change as well.
You can try JSON encoding to get around this for logging purposes:
console.log(JSON.parse(JSON.stringify(obj)));
If that's not the issue, then perhaps there's some weird async behavior going on. In that case, you can try logging the object at several other points in your code to see exactly where this behavior starts.

Download files to a specific location using Postman

https://forge.autodesk.com/en/docs/data/v2/tutorials/download-file/#step-6-download-the-item
I have followed the tutorial and have successfully obtained the contents of the file, but where is the file being downloaded. In addition, how do I specify the location of where I want to download the file?
Result on Postman
Instead of Send, hit the downward arrow immediately on the right and select Send and Download in the dropdown. Then once the response comes back you will be prompted with where to save the download:

Google Drive API Console: Error saving Drive UI integration page

I have a webapp in production that interacts with Google Drive through Google Drive API.
I need to change some settings in Drive interaction but I can't save.
When I save the Drive UI integration page, I receive this error:
There's a problem at our end.
Please try again. If the problem persists, please let us know using
the "Send feedback" link below. Thanks!
(spying Network console: there is an Internal Server Error in a POST call)
I tried to send feedback for months: nobody answers and the bug is still there.
I tried also to create another project: I can save the first time but then the bug returns.
How can I do? Has someone the same problem?
Is there a way to receive a reply from Google? Is there some workaround?
Thank you.
i think that problem must be Client ID
before adding Client ID, go to the Credentials -> OAuth 2.0 Client IDs
then select edit your Client ID. after that your production site url add to Authorized JavaScript origins and Authorized redirect URIs.
then enter your Client ID in Drive UI integration page
For myself trying to get the Drive UI configured I noticed a couple of errors (that don't have any specific error messages)
When adding in an Open URL it has to be a valid domain, so for instance I tried to test it out with local host, to no avail. However something like https://devbox.app.com worked, but something like https://localhost:8888 does not. Even though https://localhost is a valid javascript origin in the client_id configuration (at least for the app I am working on, not sure about other apps), localhost doesn't work as an open URL.
When adding in the mimeTypes it needs to be in the format */* and can include custom mimeTypes like application/custom+xml and application/custom-name+json not sure for other custom types that are not in a particular format like xml or json. Also not sure about wildcards.
When adding in file extensions do not add in the '.' just the name of the file extension.
The app icon I found only failed to upload the image when the image wasn't the exact dimensions, I actually ended up editing some icons in photoshop to change the pixel x pixel values as a quick work around during dev.
That worked for me to get it to save and I tested it with a file that had a custom mimeType (application/custom-name+xml specifically) and custom file extension!

CanĀ“t open an internal page in Cypress Chrome

We have an cypress issue that is similar to the issue described in "https://github.com/cypress-io/cypress/issues/850". The reason for why I am creating a new post is that I have done some changes in the environment which makes this work but only after the first fail and then manually click on the failing URL.
Test1:
Default cypress\plugins\index.js file (no changes)
lauch the internal page cy.visit('xxx')
Error 401.
Click on the link below the error text. Another tab is opened and message UNAUTHORIZED is shown.
Paste same URL in default Chrome->works fine.
Test2:
Modify the cypress\plugins\index.js: args.push('--proxy-pac-url=xxx') (I have tested other arguments but this is the only one that makes something different)
Lauch the internal page cy.visit('xxx')
Error 403.
Click on the link below the error text. Another tab is opened and the page is shown CORRECTLY.
This is the reason why I post this new message. I want to ask if there is a way to get Cypress to open the page automatically via cy.visit() in the same way as when I click on the failing URL and it opens the page in the same cypress browser but just another tab?

unable do download file from ie11

unable do download file from ie11, when click on download button post request send to the server. I checked in network section the response will come with content of file but in internet explorer 11 download prompt will not appear instead of that if display error page can not display and url will not correct . This program working fine with Mozilla Firefox.
I created a demo program which runs on my local host with same configuration ie11 works fine. but same program I tried to run on my production server tomcat getting same error.
I had this same problem,but incase of PDF's my pdf file was not downloading from IE, in my case also the file was getting downloaded from the Firefox, I just checked the url, there is no such limit to the length of the url but in this I just reduced the length of the url and it worked, but I didn't get what IE does different in this maybe its the server which is handling the request from IE differently or while sending IE is doing something different, just check if this works, reduce the length of the url and try again.

Resources