Upload / Up1

Client-side encrypted image host web server
MIT License
813 stars 97 forks source link

Use base64-encoded data URIs for displaying content to allow native interaction #32

Closed justjanne closed 8 years ago

justjanne commented 8 years ago

Expected behaviour:
I can right-click on any image, audio file, video, etc and open it in a new tab, save it in different places, etc. The files behave as if they were natively accessed directly over HTTP.

Actual behaviour:
Right-clicking does not allow downloading, accessing or otherwise interacting with the files, the files can not be opened in a new tab

Suggested solution:
Try to emulate native behaviour by using native widgets, for this use base64-encoded data URIs.

ultramancool commented 8 years ago

You can do this... it works for me in Firefox at least.

ultramancool commented 8 years ago

What browser are you using? We currently use blob URLs but this appears to allow native behavior in Chrome and Firefox at least.

justjanne commented 8 years ago

Does not work in Firefox for me. I can right-click, but "view image" or "save as" do nothing, and "view image info" reports a 0x0px PNG image

ultramancool commented 8 years ago

@justjanne Very strange. Both work for me.

One small note is that the default Firefox image viewer looks quite similar to the one in Up1, if you do right click -> view image you should notice that the header and buttons vanish and the URL should change to a blob URL like

blob:https://up1.ca/bff7d92e-cfae-42f3-b482-14781f474e5a. 

Save as also appears working on Firefox 40 running on Windows 10 and Ubuntu. What version of Firefox are you running and do you have any extensions installed that may affect this?

justjanne commented 8 years ago

Currently running Firefox Dev-Edition 40 on Arch Linux, no extensions enabled that can interfere.

I am sure it is not the default viewer, as the download button, etc still stay.

ultramancool commented 8 years ago

Using the latest dev edition build (41.0a2) on Windows it appears to be working. Could you try a clean profile or something? I've been running this by other Firefox users and no one has been able to duplicate it yet.

"view image info" reports a 0x0px PNG image

That view image info behavior is actually normal in Firefox apparently, I guess the View Image Info thing doesn't have access to the blob where the image is created. However, save and view image do still work on clean Firefox installs. Even if you save the image from the view image info dialog it does appear to work (though it won't get a very useful filename).

justjanne commented 8 years ago

It just doesn’t even show the save image dialog – I can press the menu option and nothing happens. I just tested on a different computer running Ubuntu with a clean firefox profile, same issue.

andre-d commented 8 years ago

Which Firefox version? On Aug 13, 2015 4:44 PM, "Janne Koschinski" notifications@github.com wrote:

It just doesn’t even show the save image dialog – I can press the menu option and nothing happens. I just tested on a different computer running Ubuntu with a clean firefox profile, same issue.

— Reply to this email directly or view it on GitHub https://github.com/Upload/Up1/issues/32#issuecomment-130835210.

ultramancool commented 8 years ago

@andre-d That was answered a while ago, read the whole thread. Unless you can duplicate this, I'm going to close as unable to reproduce. I've had 4 people independently test this and fail to reproduce the problem so far.

andre-d commented 8 years ago

Sorry, 40, I see now. And you are sure you have no extension? Embeds are accessed as blob URLs which browsers should treat totally natively.

If the browser shows the button and it is not disabled then it should work correctly so I am puzzled as to what would cause that. On Aug 13, 2015 6:03 PM, "Andre D" andre@andred.ca wrote:

Which Firefox version? On Aug 13, 2015 4:44 PM, "Janne Koschinski" notifications@github.com wrote:

It just doesn’t even show the save image dialog – I can press the menu option and nothing happens. I just tested on a different computer running Ubuntu with a clean firefox profile, same issue.

— Reply to this email directly or view it on GitHub https://github.com/Upload/Up1/issues/32#issuecomment-130835210.

andre-d commented 8 years ago

I can not duplicate this issue no matter how hard I try on various machines and various browsers (including Linux machines). If you believe you have found a Firefox issue please file one with their bug tracker, but as we're unable to duplicate this, we're unable to file it with them. I have had multiple folks on multiple setups unable to replicate this issue.

Blob URLs are the perfect solution for this designed to do exactly what we are doing (access typed arrays via regular browser interaction with a mime type anywhere a URL is required) compared to the hack that base64 data URIs are. Blob URLs do not require us to duplicate memory away from the typed arrays and work properly on files of large sizes. Switching to base64'd data URIs would greatly impact performance.

It sounds like your blob is expiring or invalidating in some other way, but I can not figure out why it would do that, I tried leaving a tab open for hours while doing many other operations even and was still able to save. Is it possible your system is low on memory or disk space for cache? Even if that's the situation, it would be a Firefox bug, not an Up1 issue and to my knowledge Firefox does not invalidate blobs unless you navigate away from the page which created them.

As such, I'm closing this as cannot reproduce unless someone can find a reliable way to cause this.