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

Can't add URL via API with a list by ID #774

Closed
m0nhawk opened this issue Apr 1, 2024 · 7 comments · Fixed by #788
Closed

Can't add URL via API with a list by ID #774

m0nhawk opened this issue Apr 1, 2024 · 7 comments · Fixed by #788
Labels
Bug Something isn't working

Comments

@m0nhawk
Copy link
Contributor

m0nhawk commented Apr 1, 2024

Bug Description

The Array of integers doesn't work for /api/v1/links.

How to reproduce

  1. Create list with id 1 (on new instance).
  2. Submit JSON via API.
{
  "url": "https://duckduckgo.com",
  "lists": [
    1
  ],
  "is_private": true
}
  1. 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

@m0nhawk m0nhawk added the Bug Something isn't working label Apr 1, 2024
@Kovah
Copy link
Owner

Kovah commented Apr 30, 2024

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.

@Kovah
Copy link
Owner

Kovah commented May 2, 2024

Tested this with the latest version, looks fine. Could you please retry this with your LinkAce?

@Kovah Kovah added the not reproducible Issues with LinkAce cannot be reproduced to find a suitable fix label May 2, 2024
@m0nhawk
Copy link
Contributor Author

m0nhawk commented May 2, 2024

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:

$newEntry = Tag::find($entry);

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).

@m0nhawk
Copy link
Contributor Author

m0nhawk commented May 2, 2024

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).

@m0nhawk
Copy link
Contributor Author

m0nhawk commented May 2, 2024

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:

Screenshot from 2024-05-02 03-48-48

@Kovah Kovah removed the not reproducible Issues with LinkAce cannot be reproduced to find a suitable fix label May 2, 2024
Kovah added a commit that referenced this issue May 2, 2024
@Kovah
Copy link
Owner

Kovah commented May 2, 2024

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.

@Kovah Kovah linked a pull request May 2, 2024 that will close this issue
@Kovah Kovah closed this as completed in #788 May 2, 2024
@m0nhawk
Copy link
Contributor Author

m0nhawk commented May 2, 2024

Thank you for fix and release. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants