LinkAce
LinkAce copied to clipboard
Can't add URL via API with a list by ID
Bug Description
The Array of integers doesn't work for /api/v1/links
.
How to reproduce
- Create list with id 1 (on new instance).
- Submit JSON via API.
{
"url": "https://duckduckgo.com",
"lists": [
1
],
"is_private": true
}
- See that the URL doesn't have list.
String or list of strings works, only list of integers doesn't.
Expected behavior
URL has a list.
Logs
No response
Screenshots
No response
LinkAce version
v1.14.1
Setup Method
Docker
Operating System
Linux (Ubuntu, CentOS,...)
Client details
No response
I will check this again after upgrading the demo to version 1.14.1, but it's working with version 1.14.0.
curl --request POST \
--url https://demo.linkace.org/api/v1/links \
--header 'Accept: application/json' \
--header 'Authorization: Bearer s9anum7ODLsxbMQCr4WnYSahCEZViFEB' \
--header 'Content-Type: application/json' \
--data '{
"url": "https://duckduckgo.com",
"lists": [
1
],
"is_private": true
}'
See https://demo.linkace.org/lists/1 then.
Tested this with the latest version, looks fine. Could you please retry this with your LinkAce?
That's interesting...
I checked the demo, it works there.
After that I tried both simple and advanced Docker setup, with both 1.14.0 and 1.14.1 - and it didn't work for me.
I narrowed it down to this line so far:
https://github.com/Kovah/LinkAce/blob/ccd3f4411afb51c7e1556afb7ce4fbf722082f75/app/Repositories/LinkRepository.php#L208
If I replace it with $newEntry = LinkList::find($entry);
- it works, but obviously it won't work for tags now.
I don't know Laravel, so can't really understand how it can work in you Demo deployment vs clean Docker setup (I have deployed separate deployment for testing).
I narrowed it down further:
If there is no tag with the same id as a list - it will fail to add a list.
For example, if list has id 1 and there is a tag with id 1 - it will succeed, but if I remove the tag - it will stop working (adding correct list).
I can reproduce it on demo instance.
I have removed tag with id 3 (maps) and now it fails to add the correct list.
Instead it shows this for this link:
Thanks for the find! Indeed the code is simply incorrect. I fixed it and will have a look at other issues. If there's nothing else, a release goes out today.
Thank you for fix and release. :+1: