ActiveStorage links are too long!

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

ActiveStorage links are too long!

Aleksandr Shelestov

A question to the creators of ActiveStorage.

I just implemented the upload feature to my own editor (nothing special, something similar to Github Text Editor). After the user dropped the file to the textarea the uploading process starts and puts a returned link back to the editor:

62838761-06ac3000-bc89-11e9-98ea-cf4a428d6c4b.png

The questions is — why the hell the links are so long?! What's the point?

First, there is a limited amount of chars in the editor. Second, it just looks ugly. And if I add ten pictures in a row it's getting even much uglier.

Why is it not something like this:

![2019-05-28 10.37.34.jpg](/r/a_s/b/eyJfcmFpbHMiO.jpg)
?


Maybe I missed something and there is a way to get back a shorter version?

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/b9748bd4-9edb-4475-8f25-a811497cf4fc%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: ActiveStorage links are too long!

Walter Lee Davis
I'm not an author of this gem, but at a guess, I would say that the lengthy URLs are there to ensure that there is no chance of two people uploading a same-name file and getting a collision. Those look a lot like UUIDs, which are often used for this purpose. Remember, when you drag something into the editor, the parent record has not been saved, and so you could not do anything clever like add the parent record ID to the URL so it could be used for disambiguation.

Walter

> On Aug 11, 2019, at 4:36 PM, Aleksandr Shelestov <[hidden email]> wrote:
>
> A question to the creators of ActiveStorage.
>
> I just implemented the upload feature to my own editor (nothing special, something similar to Github Text Editor). After the user dropped the file to the textarea the uploading process starts and puts a returned link back to the editor:
>
> <62838761-06ac3000-bc89-11e9-98ea-cf4a428d6c4b.png>
>
> The questions is — why the hell the links are so long?! What's the point?
>
> First, there is a limited amount of chars in the editor. Second, it just looks ugly. And if I add ten pictures in a row it's getting even much uglier.
>
> Why is it not something like this:
>
>
> ![2019-05-28 10.37.34.jpg](/r/a_s/b/eyJfcmFpbHMiO.jpg)
> ?
>
>
> Maybe I missed something and there is a way to get back a shorter version?
>
>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/b9748bd4-9edb-4475-8f25-a811497cf4fc%40googlegroups.com.
> <62838761-06ac3000-bc89-11e9-98ea-cf4a428d6c4b.png>

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/6D94E210-6944-4408-B898-4C30680728C8%40wdstudio.com.
Reply | Threaded
Open this post in threaded view
|

Re: ActiveStorage links are too long!

Aleksandr Shelestov
Thanks for reply Walter.

I'm not sure I need all this stuff and even I understand the purpose of it.

For unique UUID a simple hash is more than enough (Youtube stores billions of unique videos using just 11 chars). And I'm even not saying about the url-shortener services.
SecureRandom lets us to create unique tokens almost for everything, using 24 characters (for example).

In my case users should be able to upload files into the editor, with no relations with the editable Article, just it. It's a simple feature we all need very often. Why other libraries don't generate so long links for this?

Also, I just found out, the long link is always a redirect to the App to get a temporary link to a storage service, so it won't be cached by browsers, ever. Jeez...

Looks like ActiveStorage is a unique tool for certain things in Basecamp, not a Carrierwave substitute. Am I right?

On Monday, August 12, 2019 at 2:39:21 AM UTC+3, Walter Lee Davis wrote:
I'm not an author of this gem, but at a guess, I would say that the lengthy URLs are there to ensure that there is no chance of two people uploading a same-name file and getting a collision. Those look a lot like UUIDs, which are often used for this purpose. Remember, when you drag something into the editor, the parent record has not been saved, and so you could not do anything clever like add the parent record ID to the URL so it could be used for disambiguation.

Walter

> On Aug 11, 2019, at 4:36 PM, Aleksandr Shelestov <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="qKq0EEkvAAAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">shor...@...> wrote:
>
> A question to the creators of ActiveStorage.
>
> I just implemented the upload feature to my own editor (nothing special, something similar to Github Text Editor). After the user dropped the file to the textarea the uploading process starts and puts a returned link back to the editor:
>
> <62838761-06ac3000-bc89-11e9-98ea-cf4a428d6c4b.png>
>
> The questions is — why the hell the links are so long?! What's the point?
>
> First, there is a limited amount of chars in the editor. Second, it just looks ugly. And if I add ten pictures in a row it's getting even much uglier.
>
> Why is it not something like this:
>
>
> ![2019-05-28 10.37.34.jpg](/r/a_s/b/eyJfcmFpbHMiO.jpg)
> ?
>
>
> Maybe I missed something and there is a way to get back a shorter version?
>
>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="qKq0EEkvAAAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">rubyonra...@googlegroups.com.
> To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/rubyonrails-talk/b9748bd4-9edb-4475-8f25-a811497cf4fc%40googlegroups.com" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/rubyonrails-talk/b9748bd4-9edb-4475-8f25-a811497cf4fc%40googlegroups.com&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/rubyonrails-talk/b9748bd4-9edb-4475-8f25-a811497cf4fc%40googlegroups.com&#39;;return true;">https://groups.google.com/d/msgid/rubyonrails-talk/b9748bd4-9edb-4475-8f25-a811497cf4fc%40googlegroups.com.
> <62838761-06ac3000-bc89-11e9-98ea-cf4a428d6c4b.png>

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/0a5076a3-44cb-4e1e-9063-0e68378aca0e%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: ActiveStorage links are too long!

Walter Lee Davis
We're trying it out here, not sure if it will replace Shrine or not. It's optional, so you don't have to use it. But note that Paperclip was deprecated the moment that ActiveStorage was announced. "Bundled" is better than "add-on" for many people. https://shrinerb.com is really wonderful, and so well supported that I genuinely worry about the developer burning out.

One other thing that they may be doing with the lengthy URLs is "security through obscurity", so that the URLs are genuinely un-guessable. Not to say that a YouTube hash is any more guessable.

Walter

> On Aug 11, 2019, at 9:14 PM, Aleksandr Shelestov <[hidden email]> wrote:
>
> Thanks for reply Walter.
>
> I'm not sure I need all this stuff and even I understand the purpose of it.
>
> For unique UUID a simple hash is more than enough (Youtube stores billions of unique videos using just 11 chars). And I'm even not saying about the url-shortener services.
> SecureRandom lets us to create unique tokens almost for everything, using 24 characters (for example).
>
> In my case users should be able to upload files into the editor, with no relations with the editable Article, just it. It's a simple feature we all need very often. Why other libraries don't generate so long links for this?
>
> Also, I just found out, the long link is always a redirect to the App to get a temporary link to a storage service, so it won't be cached by browsers, ever. Jeez...
>
> Looks like ActiveStorage is a unique tool for certain things in Basecamp, not a Carrierwave substitute. Am I right?
>
> On Monday, August 12, 2019 at 2:39:21 AM UTC+3, Walter Lee Davis wrote:
> I'm not an author of this gem, but at a guess, I would say that the lengthy URLs are there to ensure that there is no chance of two people uploading a same-name file and getting a collision. Those look a lot like UUIDs, which are often used for this purpose. Remember, when you drag something into the editor, the parent record has not been saved, and so you could not do anything clever like add the parent record ID to the URL so it could be used for disambiguation.
>
> Walter
>
> > On Aug 11, 2019, at 4:36 PM, Aleksandr Shelestov <[hidden email]> wrote:
> >
> > A question to the creators of ActiveStorage.
> >
> > I just implemented the upload feature to my own editor (nothing special, something similar to Github Text Editor). After the user dropped the file to the textarea the uploading process starts and puts a returned link back to the editor:
> >
> > <62838761-06ac3000-bc89-11e9-98ea-cf4a428d6c4b.png>
> >
> > The questions is — why the hell the links are so long?! What's the point?
> >
> > First, there is a limited amount of chars in the editor. Second, it just looks ugly. And if I add ten pictures in a row it's getting even much uglier.
> >
> > Why is it not something like this:
> >
> >
> > ![2019-05-28 10.37.34.jpg](/r/a_s/b/eyJfcmFpbHMiO.jpg)
> > ?
> >
> >
> > Maybe I missed something and there is a way to get back a shorter version?
> >
> >
> > --
> > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> > To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
> > To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/b9748bd4-9edb-4475-8f25-a811497cf4fc%40googlegroups.com.
> > <62838761-06ac3000-bc89-11e9-98ea-cf4a428d6c4b.png>
>
>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/0a5076a3-44cb-4e1e-9063-0e68378aca0e%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/9A27488F-336A-4EA0-800F-B3F0AF0E2248%40wdstudio.com.
Reply | Threaded
Open this post in threaded view
|

Re: ActiveStorage links are too long!

Rob Jonson
In reply to this post by Aleksandr Shelestov


Also, I just found out, the long link is always a redirect to the App to get a temporary link to a storage service, so it won't be cached by browsers, ever. Jeez...

Looks like ActiveStorage is a unique tool for certain things in Basecamp, not a Carrierwave substitute. Am I right

At the moment, the link always redirects through the app. This enables a bunch of things on the final download link (like time-limited signed links)

I completely agree that it is an annoying over-abstraction for many standard cases.

the good news is that there seems to be decent progress on improving this (though unclear when it will actually get into rails)


--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/95979270-2810-4812-86ee-aaf4b8dbd1ac%40googlegroups.com.