Bookmarks: Moving bookmarks into a folder via API will instead create an additional link to this folder

Created on 29 Jun 2020  路  9Comments  路  Source: nextcloud/bookmarks

Describe the bug
When PUTting a bookmark via the API and altering the "folders" key, it will only add the new value to the "folders" array instead of overwriting the existing array. So moving a bookmark between folders or removing it from a folder is currently not possible via the API.

To Reproduce
Steps to reproduce the behavior:

  1. Bookmark with id 1337 in folder with id 555
  2. PUT https://your.next.cloud/index.php/apps/bookmarks/public/rest/v2/bookmark/1337 with body:
{ 
"url": "http://bookmark.url",
"title": "bookmark.title",
"description": "bookmark.description",
"tags": ["tag", "asdf"],
"folders": [666]
}
  1. Receive a body with ..."folders": [555, 666]...

Expected behavior
200, ..."folders": [666]...

Desktop (please complete the following information):

  • OS: MacOS X
  • Browser: Firefox
  • Version 77.0.1

Server (please complete the following information):

  • OS: Ubuntu 18.04.4 LTS
  • HTTP server: nginx 1.14.0-0ubuntu1.7
  • Database mariadb 10.5.4
  • PHP version: 7.4.7
  • Nextcloud version: 19.0.0
  • Bookmarks app version: 3.2.4

Nextcloud log (nextcloud/data/nextcloud.log)

No Error logged
bug

All 9 comments

Thanks for reporting these! Apparently, my floccus tests also caught this one, but I failed to notice it :see_no_evil:

btw, out of curiosity, what kind of client are you working on? :)

I'm working on an iOS client (Nextbookmark). Mostly because I just wanted to easily upload URLs to Bookmarks but it somehow found an audience and therefore I'm slowly working my way through your API :)

Have you published it on the appstore as well?

yes

Shall we link to it in the README here?

Sounds good. Here you go

mmmh, for some reason my floccus CI tests fail, while everything passes locally :thinking:
Can you try running your app against latest master?

Created a local dev environment based on the Nextcloud "stable19" branch, your master branch, a sqlite db and ran the requests against that env: The odd behaviour is gone 馃憤
And just to be sure that is is not dependend on running with a local, non-productive webserver or sqlite db... I deleted the app, installed it in the same enviroment from the app store (v3.2.4) and ran the tests again: Odd behaviour is back again :)

Oof, I've finally sorted out my CI issues and can do a realease in confidence now. :sweat_smile:

Was this page helpful?
0 / 5 - 0 ratings

Related issues

fazlerabbi37 picture fazlerabbi37  路  4Comments

marcelklehr picture marcelklehr  路  6Comments

NWiogrhkt picture NWiogrhkt  路  4Comments

bspire picture bspire  路  4Comments

saywebsolutions picture saywebsolutions  路  6Comments