Here's a patch I wrote for editing existing URLs against 6.x-1.0. It works in conjunction with the API key authentication patch from http://drupal.org/node/982268 and allows a remote site to update the long url associated with a short url if the api key matches.

My use case is that I use a separate site for shurly and use the API key authentication patch to allow a remote drupal site to create short URLs with my shurly site, however as I use path auto on the remote site the shortened urls would otherwise break every time the title of a node on the remote site is changed.

CommentFileSizeAuthor
shurly_edit_urls_via_api.patch6.07 KBbeanjammin

Comments

beanjammin’s picture

Status: Active » Needs review

Forgot to switch the status earlier.

benlotter’s picture

Hello Beanjammin. How about a little help for those of use that have no idea how to apply a .patch file. I used NotePad++ to manually edit this module to disallow anonymous use (http://drupal.org/node/1039820#comment-6214990). I have the same scenario in that I use PathAuto, so for the moment I'm stuck manually editing in the database each time the path changes. I'd love to use your patch but I'm not sure if I can figure out which lines to edit (I see that the + seems to indicate adding a new line but I don't know what to do with the @@ lines).

I would be very cool of you to post the entire (modified) .module file so I can use this feature. Or send me a PM with the same information. Thanks in advance.
~Benjamin

benlotter’s picture

Okay, I figured out a workaround. I remember that the path redirect (or is it Global redirect) add the ability to NOT delete the old alias but redirect it. I'm using that for now to keep the links working, so no hurry on the .module file although I'd like this functionality eventually.

chocolatfrog’s picture

Anyone have tried that patch and work all right? Editing a existing shortened URL could be very intersting

benlotter’s picture

Version: 6.x-1.0 » 7.x-1.1
Issue summary: View changes

Contrary to what it says on the project page, I cannot find a way to edit the URL unless I go into the database. Where do I go to edit the URL after it has been entered? I think the documentation is incorrect.

  • Administer short URLs:
  • This permission allows users to edit/delete/view all short URLs by
    all users. This is the administrative permission and should be
    used carefully.

This would be a very helpful feature and save a lot of time going into the database every time we need to re-point a URL somewhere else.

jibus’s picture

The initial maintainer didn't want this functionnality :

https://www.drupal.org/node/1004560#comment-3854660

But i guess, we can implement it under certain conditions.

makangus’s picture

Editing an existing URL will also have some serious caching issues if the destination is changed, but the short url remains the same. The module redirects with a HTTP 301 Moved Permanently, which indicates that the url redirected to is never going to change. The browser (at least chrome and firefox) will take the opportunity and cache the redirect forever, until the user manually clear the browser cache. Basically, if the destination is changed for a short url, all of the returning users will keep getting redirected to the old url after until they clean the cache by hand.

beanjammin’s picture

Good point. Perhaps this functionality should be toggleable and when its enabled shurly uses a 302 instead of a 301 for redirection.

jibus’s picture

Status: Needs review » Closed (duplicate)