Describe the bug
If a bookmark's URL contains a '#', you can't search by URL via the api.
$ curl -s \
--request GET "https://example.com/index.php/apps/bookmarks/public/rest/v2/bookmark" \
--header "Authorization: Basic AUTH" \
--header "Content-Type: application/json" |gron
json = {};
json.data = [];
json.data[0] = {};
json.data[0].added = 1607105793;
json.data[0].archivedFile = null;
json.data[0].available = true;
json.data[0].clickcount = 0;
json.data[0].description = "";
json.data[0].folders = [];
json.data[0].folders[0] = -1;
json.data[0].id = 85;
json.data[0].lastPreview = 0;
json.data[0].lastmodified = 1607105793;
json.data[0].tags = [];
json.data[0].title = "https://nextcloud.com/";
json.data[0].url = "https://nextcloud.com/";
json.data[0].userId = "user";
json.data[1] = {};
json.data[1].added = 1607105519;
json.data[1].archivedFile = null;
json.data[1].available = true;
json.data[1].clickcount = 0;
json.data[1].description = "";
json.data[1].folders = [];
json.data[1].folders[0] = -1;
json.data[1].id = 84;
json.data[1].lastPreview = 0;
json.data[1].lastmodified = 1607105519;
json.data[1].tags = [];
json.data[1].title = "http://www.ics.uci.edu/pub/ietf/uri/#Related";
json.data[1].url = "http://www.ics.uci.edu/pub/ietf/uri/#Related";
json.data[1].userId = "user";
json.status = "success";
$ curl -s \
--request GET "https://example.com/index.php/apps/bookmarks/public/rest/v2/bookmark?url=http://www.ics.uci.edu/pub/ietf/uri/#Related" \
--header "Authorization: Basic AUTH" \
--header "Content-Type: application/json" |gron
json = {};
json.data = [];
json.status = "success";
$ curl -s \
--request GET "https://example.com/index.php/apps/bookmarks/public/rest/v2/bookmark?url=https://nextcloud.com/" \
--header "Authorization: Basic AUTH" \
--header "Content-Type: application/json" |gron
json = {};
json.data = [];
json.data[0] = {};
json.data[0].added = 1607105793;
json.data[0].archivedFile = null;
json.data[0].available = true;
json.data[0].clickcount = 0;
json.data[0].description = "";
json.data[0].folders = [];
json.data[0].folders[0] = -1;
json.data[0].id = 85;
json.data[0].lastPreview = 0;
json.data[0].lastmodified = 1607105793;
json.data[0].tags = [];
json.data[0].title = "https://nextcloud.com/";
json.data[0].url = "https://nextcloud.com/";
json.data[0].userId = "user";
json.status = "success";
To Reproduce
Add a bookmark where the URL contains a '#' and search by URL via the api.
Expected behavior
URL that contains a '#' should act with URLs without them.
Screenshots
n/a
Desktop (please complete the following information):
n/a
Server (please complete the following information):
n/a
Additional context
n/a
Web server error log
n/a
Browser log
n/a
For searching purposes, here are various way this character is referred by. Number sign, pound sign, hash, U+0023, #, #, hashtag, hex, octothorp and sharp.
Hi,
the hash is likely interpreted to belong to the API url by the web server. Have you tried url encoding the hash / the whole url?
@marcelklehr,
Good catch. Just URL encoding the hash did not work, but encoding the whole URL did work. Thanks