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

Setting replace=yes has unpredictable effects on posts/add #22

Open
dlo opened this issue Apr 25, 2014 · 9 comments
Open

Setting replace=yes has unpredictable effects on posts/add #22

dlo opened this issue Apr 25, 2014 · 9 comments

Comments

@dlo
Copy link

dlo commented Apr 25, 2014

If I set replace=yes for posts/add, Delicious is sometimes adding a new bookmark even if an existing bookmark with the specified URL already exists in my collection, and sometimes throws a 500 with no error message.

URL that adds a new bookmark: http://www.edudemic.com/6-ways-students-can-collaborate-with-ipads/

URL that throws a 500: http://www.zeldman.com/2014/03/09/evolving-responsive-web-design/?utm_content=bufferfdcaa&utm_medium=social&utm_source=twitter.com&utm_campaign=buffer

@vjkaruna
Copy link
Contributor

Hi Dlo -
The second link works for me (see my account https://delicious.com/vjkaruna ) although remember the "&" symbols in the URL need to be URL-encoded if you intend to preserve them. If you do not URLencode, the HTTP GET call cannot differentiate between API parameters and URL parameters.
For the second link, make sure the URL in the "&url=" param that you are replacing is identical. Delicious will attempt to canonicalize URLs to make them similar, for example removing a port ":80" from a HTTP URL. Querying "posts/all" should tell you the exact URL to replace.
I can also take a look if you list your Delicious account.
-vj

@dlo
Copy link
Author

dlo commented Apr 25, 2014

Thanks! Will follow up in a few.

@dlo
Copy link
Author

dlo commented Apr 25, 2014

Here's the exact request I'm making for the second URL:

https://api.delicious.com/v1/posts/add?description=Evolving%20Responsive%20Web%20Design%20%E2%80%93%20Jeffrey%20Zeldman%20Presents%20The%20Daily&extended=&replace=yes&shared=yes&tags=article%20design%20reference&url=http%3A%2F%2Fwww.zeldman.com%2F2014%2F03%2F09%2Fevolving-responsive-web-design%2F%3Futm_content%3Dbufferfdcaa%26utm_medium%3Dsocial%26utm_source%3Dtwitter.com%26utm_campaign%3Dbuffer

And here's output from my posts/all--if you look at the first two bookmarks you'll see that it's the same URL, duplicated. My account is "lionheartsw". Thanks!

<posts tag="" total="8" user="lionheartsw">
    <post description="6 Ways Students Can Collaborate With iPads - Edu" extended="" hash="5ad5c653e3cd70cd5e0786636bcad5ad" href="http://www.edudemic.com/6-ways-students-can-collaborate-with-ipads/" private="no" shared="yes" tag="collaborate ipad" time="2014-04-25T15:03:09Z"/>
    <post description="6 Ways Students Can Collaborate With iPads - Edudemic" extended="" hash="6f46a71b61cfcce1a75c0bd801fea5ad" href="http://www.edudemic.com/6-ways-students-can-collaborate-with-ipads/" private="yes" shared="no" tag="collaborate ipad" time="2014-03-10T17:32:54Z"/>
    <post description="Evolving Responsive Web Design – Jeffrey Zeldman Presents The Daily Report" extended="" hash="404d0f9e356143f0e503b0e21444a6d3" href="http://www.zeldman.com/2014/03/09/evolving-responsive-web-design/?utm_content=bufferfdcaa&utm_medium=social&utm_source=twitter.com&utm_campaign=buffer" private="no" shared="yes" tag="article design reference" time="2014-03-10T17:32:33Z"/>
    <post description="sweetnbake.com" extended="" hash="48e2bd95f94621f1db0a3cf66e554b2f" href="http://sweetnbake.com/apple-streusel-melts/" private="no" shared="yes" tag="apple sweets" time="2014-03-10T17:32:20Z"/>
    <post description="Securelist - Information about Viruses, Hackers and Spam" extended="" hash="00c8846b9cad76c51de473e567729746" href="http://www.securelist.com/en/" private="no" shared="yes" tag="antivirus malware security" time="2014-03-10T17:32:14Z"/>
    <post description="reddit: what's new online" extended="" hash="b19d8eee8d2c4e4062d9242b94a7da61" href="http://www.reddit.com/" private="yes" shared="no" tag="reddit news popular article" time="2014-02-04T17:36:25Z"/>
    <post description="MacStories" extended="Last week, I was looking at the way I use Safari and save links to other apps and services, and I realized that I wanted a unified action menu to group some of my most used bookmarklets together. While this can be done by creating a bookmark folder in Safari, folders require too many taps on the iPhone and I’d like to have better visual differentiation between actions with unique icons for each one of them. That seemed like a good opportunity to test the capabilities of Launch Center Pro (now on the iPad as well) when it comes to lists and JavaScript, so I got to work." hash="5e4b3201ebc915f8431c7219bef9749c" href="http://www.macstories.net/" private="no" shared="yes" tag="pythonista apple ios" time="2014-02-04T17:36:00Z"/>
    <post description="apple.com" extended="iPad Air and iPad mini with Retina display. Two ways to your valentine’s heart." hash="0f82f8155826020d153245b61160ed4e" href="http://www.apple.com/" private="no" shared="yes" tag="apple ipad iphone" time="2014-02-04T17:35:35Z"/>
</posts>

@vjkaruna
Copy link
Contributor

In the second URL, it appears to be an issue with the "long hyphen" character (encoded as "%E2%80%93%") in your description field. I'll see why that might cause issues with our redirect, but in the meantime you should be able to save by avoiding or encoding that character differently.

For the first URL, it appears to be some issue where a previously saved version of that link ended up with a different MD5 hash - I'll take a look.

@dlo
Copy link
Author

dlo commented Apr 28, 2014

I'm not sure how else I can encode that character. What would you suggest?

And yep, removing that character did it. Is there a list of invalid characters that cannot be set in description fields? Is it ascii only?

As for the first URL, any update there?

@dlo
Copy link
Author

dlo commented May 12, 2014

@vjkaruna are you still lead on this or should I reach out to one of the Science people?

mmerriam added a commit to mmerriam/chrome-ext-delicious that referenced this issue May 22, 2014
…is is bc the API is failing on addLink calls when crazy chars are found in the description field (pulled from title value). domainersuitedev/delicious-api#22
mmerriam added a commit to mmerriam/chrome-ext-delicious that referenced this issue May 24, 2014
…hars. This is bc the API is failing on addLink calls when crazy chars are found in the description field (pulled from title value). domainersuitedev/delicious-api#22"

This reverts commit 8677690.
@tonioriol
Copy link

As commented in: https://github.com/zmanring/chrome-ext-delicious/issues/55 the only solution is a "hack". For the parameter "url" with non ascii characters, the best choice is double urlencode the value, works perfectly (as far as I've tried). But for the "description" and "extended" parameters, the only way is to remove/replace the non-ascii characters. Because i observed that the double urlencoding works with all characters that i've tried except "í" and "ó". I didn't try all the non-ascii characters one by one, so I think the best workaround is to delete them.

Hope it helps!

And please, the people who maintain this api, fix these errors please!

@peoplemerge
Copy link
Contributor

I hope to carve out most of next week to fix issues like this. Please keep up the comments!

@tonioriol
Copy link

Oh! That is really cool @peoplemerge! I've started to build a Laravel package wrapper for the delicious api, and i spent hours and hours trying to figure out why this is happening.

When this problem is fixed, I will publish the package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants