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

Sharing files by direct link #16470

Open
non7top opened this issue May 20, 2015 · 31 comments
Open

Sharing files by direct link #16470

non7top opened this issue May 20, 2015 · 31 comments

Comments

@non7top
Copy link

@non7top non7top commented May 20, 2015

I'm looking for a way to use the owncloud sharing to add pictures to forums, discussion boards and similar stuff. I'm able to extract the link like
http://localhost/index.php/apps/files_sharing/ajax/publicpreview.php?x=1596&y=979&a=true&file=%25D0%2591%25D0%25B5%25D0%25B7%25D1%258B%25D0%25BC%25D1%258F%25D0%25BD%25D0%25BD%25D1%258B%25D0%25B9.png&t=6s0x3RfjZY1C6lD&scalingup=0 but it is not usable on most forums since it has invalid extension. Would be perfect to have it translated to something more simple like http://localhost/index.php/apps/files_sharing/6s0x3RfjZY1C6lD/picture.png
For now I have to use all those adware picture hosting sites.

Please consider adding this feature.

@MorrisJobke

This comment has been minimized.

Copy link
Contributor

@MorrisJobke MorrisJobke commented May 20, 2015

@LukasReschke @jancborchardt Wasn't there a similar proposal somewhere? I couldn't find it anymore.

@MorrisJobke

This comment has been minimized.

Copy link
Contributor

@MorrisJobke MorrisJobke commented May 20, 2015

Somehow slightly related to #1167 where the filename inside the URL is also mentioned

@non7top

This comment has been minimized.

Copy link
Author

@non7top non7top commented May 20, 2015

The thing is that the files are actually shared at the moment, but the link is very much hidden and the actual url is very "bad" and cannot be used on many forums. And with just a minor rework it would do what ppl expect.
Another thing to consider is an optional support for http://wiki.nginx.org/XSendfile for the sake of lowering load on php interpreter.

@MorrisJobke

This comment has been minimized.

Copy link
Contributor

@MorrisJobke MorrisJobke commented May 20, 2015

Another thing to consider is an optional support for http://wiki.nginx.org/XSendfile for the sake of lowering load on php interpreter.

I think this is already supported. see https://github.com/owncloud/core/pull/13060/files

@PVince81

This comment has been minimized.

Copy link
Member

@PVince81 PVince81 commented May 21, 2015

In theory you could also use the "public.php/webdav" endpoint. This would deliver the real file (not a reduced version). But note that this endpoint might be disabled if server to server sharing (aka federation) is disabled, as it is mainly used by that.

CC @oparoz @georgehrke for preview stuff

@oparoz

This comment has been minimized.

Copy link
Contributor

@oparoz oparoz commented May 21, 2015

@non7top - I don't understand why you don't use the shared link provided by the share dropdown and add /download at the end.

https://oc8demo.interfacloud.com/index.php/s/pvetv4RaIbFhDRb/download

If I use this in Github
Sample pic

Caveats

  • Only works for browser supported media types
  • Does not resize the original picture
@non7top

This comment has been minimized.

Copy link
Author

@non7top non7top commented May 21, 2015

Because many discussion boards out there simply check the url for valid picture extension. If none found they will reject inserting such image, regardless of whether the link actually points to a valid image or not. And the link you provided is not displayed as picture in browser so it is counterintuitive to use it as a picture.

@oparoz

This comment has been minimized.

Copy link
Contributor

@oparoz oparoz commented May 21, 2015

Thanks!
I think the best things to do would be to have an app which can generate such links. Maybe a plugin for Gallery.

@oparoz oparoz mentioned this issue May 21, 2015
@mrladeia

This comment has been minimized.

Copy link

@mrladeia mrladeia commented May 21, 2015

There is no plugin that currently do that?
The API we can do this?
Class SHARE: http://api.owncloud.org/classes/OCP.Share.html

@oparoz

This comment has been minimized.

Copy link
Contributor

@oparoz oparoz commented May 21, 2015

The easiest way to do this would probably to have an app which simply re-routes the short URL to the long one.
The hardest part would then be to create the interface which allows the user to collect the short URL.

@jancborchardt

This comment has been minimized.

Copy link
Member

@jancborchardt jancborchardt commented May 21, 2015

Linking directly to an image seems to be a core function of a sync & share software. Not just something which is an extension of the Gallery app.

@oparoz

This comment has been minimized.

Copy link
Contributor

@oparoz oparoz commented May 21, 2015

I agree, but the problem is that it will probably take a long time to land, simply because the share API has to be upgraded to generate different public links for single files which are not password protected.

The app route offers more flexibility, you could even extend it to the point where you have your own cloudconvert service available locally.

@rullzer

This comment has been minimized.

Copy link
Contributor

@rullzer rullzer commented May 22, 2015

@jancborchardt I agree... however how would this work UI wise?

@oparoz well that part should be doable. However, if a separate app is used you are stuck with on earth you get the direct url to the user. If users have to open up a separate app for that to convert the url I doubt that would be of much help.

There is however an issue with what do you use as new url? Since you probably do not want to use the filename as that might change over time.

@jancborchardt

This comment has been minimized.

Copy link
Member

@jancborchardt jancborchardt commented May 22, 2015

@rullzer similar to the current »Direct link« input below the image in a public share. We can even do some nice »copy link« stuff with HTML lately: http://updates.html5rocks.com/2015/04/cut-and-copy-commands

@oparoz

This comment has been minimized.

Copy link
Contributor

@oparoz oparoz commented May 22, 2015

@rullzer - You hijack the share dialogue and use the appropriate URL depending on what is shared.
As for the URL, something like this would always work.
/index.php/apps/smartlink/s/pvetv4RaIbFhDRb.png

@oparoz

This comment has been minimized.

Copy link
Contributor

@oparoz oparoz commented May 22, 2015

I've just tried to share a single media file on dropbox and they include the full filename in the link, but if you rename the file, the user gets a 404 and that's really bad imho, so we should try to do better, maybe like my suggestion above.

@oparoz

This comment has been minimized.

Copy link
Contributor

@oparoz oparoz commented May 22, 2015

@non7top @mrladeia I've added a way to add extensions to links. Everything is described here:
owncloud/gallery#156

You'll need to use the master version of Gallery. Simply download the zip file from the right sidebar if you don't want to use git.

Make sure to try as many different forums as you can :)

@jancborchardt

This comment has been minimized.

Copy link
Member

@jancborchardt jancborchardt commented May 27, 2015

@oparoz of course - if anything the filename should just be a nice addition to the link to make it readable. Nothing required. If the filename is changed, the URL would just change dynamically. The only thing required is the unique code in the link which points to the file.

@rullzer

This comment has been minimized.

Copy link
Contributor

@rullzer rullzer commented Jun 26, 2015

Could we not just append the file name. And if it changes throw back a 307 with the correct file name? Just to make it a bit nicer?

@oparoz

This comment has been minimized.

Copy link
Contributor

@oparoz oparoz commented Jun 26, 2015

My endpoint uses whatever the link uses, but I'm not sure it makes much of a difference if the file is posted on Imgur, etc. No?
My Share Links app is using the file ID. That way it's never impacted by the name change

@jancborchardt

This comment has been minimized.

Copy link
Member

@jancborchardt jancborchardt commented Jun 26, 2015

@rullzer yeah, that’s what I meant. The file ID is used as definite identifier, but the file name is added to make the URL more readable. It can safely be cut and the same file will be shown.

@enoch85

This comment has been minimized.

Copy link
Member

@enoch85 enoch85 commented Nov 10, 2015

It's not possible to link images so that they become embedded in forum posts afaik. That would be a great enhancement imho.

In forums

Don't work:
https://en0ch.se/index.php/s/8wnzgLI9KeyQEdg

Works:
http://i.imgur.com/Z0h8GdX.png

@PVince81

This comment has been minimized.

Copy link
Member

@PVince81 PVince81 commented Nov 10, 2015

@MorrisJobke

This comment has been minimized.

Copy link
Contributor

@MorrisJobke MorrisJobke commented Nov 10, 2015

Does this work ? https://en0ch.se/index.php/s/8wnzgLI9KeyQEdg/download

Nope. We always send a header to mark this as download and not as inline view. There are security problems with this, because then you can share a JS file and use this to inject code, because it is from the same domain. We would need to have a separat (sub-) domain to get the shares from. Or ask @LukasReschke about this ... he has also already headaches because of this 😝

@Webbeh

This comment has been minimized.

Copy link

@Webbeh Webbeh commented Dec 6, 2015

Wouldn't it be easy to mark as inline-view pictures according to their mime-types ?
I mean, having a mime-type list of all known picture formats, or even simply of most used formats (jpg, png, gif, bmp, svg, maybe others) isn't really a hassle.

The download.php class already gets the mime-type of the file, having it set inline-view for all "image/*" ones wouldn't be a great issue.
And I don't really see how this would affect safety.

@oparoz

This comment has been minimized.

Copy link
Contributor

@oparoz oparoz commented Dec 6, 2015

There is a solution for Files already. Someone just needs to make ShareLinks compatible with the new sidebar found in 8.2+. It's an app, anybody can decide whether they need the feature or not. It connects to an official route part of the Gallery app, so it's tested with every release. There is no need to add anything to core at this stage.

@enoch85

This comment has been minimized.

Copy link
Member

@enoch85 enoch85 commented Dec 15, 2015

I also want to make wget working for shared links, that would be awesome! Then I could share files from my cloud, and use them in the scripts for the VM.

EDIT: This is not just a feature for pictures, I think it should be implemented on all the shared links. As it is right now, trying to download with wget gives me a HTML document.

@PVince81

This comment has been minimized.

Copy link
Member

@PVince81 PVince81 commented Dec 15, 2015

@enoch85 curl -J -O $url might do. Use the URL with the appended "download" at the end.

But yeah, would be good if the UI would provide a URL containing the actual file name.

@enoch85

This comment has been minimized.

Copy link
Member

@enoch85 enoch85 commented Dec 15, 2015

@PVince81 Thanks! That worked. 👍

@KarlBaumann

This comment has been minimized.

Copy link

@KarlBaumann KarlBaumann commented May 11, 2018

Is there any progress on this? Has anyone written a plugin or something similar?

@Webbeh

This comment has been minimized.

Copy link

@Webbeh Webbeh commented May 12, 2018

@KarlBaumann , @oparoz has added some functionality in Gallery Plus, linked a few comments above. Works well enough with some services, not all of them sadly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
You can’t perform that action at this time.