shlinkio / shlink

The definitive self-hosted URL shortener
https://shlink.io
MIT License
3.13k stars 253 forks source link

No way to delete link with webapp #1377

Closed saiballo closed 2 years ago

saiballo commented 2 years ago

How Shlink is set-up

Summary

During installation I set "Visits threshold" to 30. If I try to delete a link in webapp (version 3.5.1) with 1 visit I read this message: "Impossible to delete short URL with short code "xxxxx", since it has more than "1" visits."

No problem if I use cli command to delete it

Current behavior

No link is deleted

Expected behavior

Link is deleted

How to reproduce

create a link and try to delete it in webapp

acelaya commented 2 years ago

Yep, I have reproduced this. No matter the value you provide, it always sets 1.

As a short term workaround, you can manually edit the config/params/generated_config.php file, and chage this value, replacing 1 with 30 (or the value you want).

-'DELETE_SHORT_URL_THRESHOLD' => 1,
+'DELETE_SHORT_URL_THRESHOLD' => 30,

Then, delete the data/cache/app_config.php file.

saiballo commented 2 years ago

thank you!!

daddiofaddio commented 2 years ago

Shlink Version: 3.0.2 Shlink Web App 3.51 PHP Version: 8.1 How do you serve Shlink: Self-hosted Nginx Database engine used: MariaDB

I have the exact same issue as above and receive the same error message from within the web app.

However, unlike above, I also cannot delete the affected shorturls from cli. When attempting to delete via cli, I receive a message saying "[ERROR] No URL found with short code "xxxx" for domain "https://xxx/xxxx". However, the short code (same as the confirmation code entered to confirm deletion within the web app) is correct.

I tried the fix just posted on two different instances of shlink on different servers -- changed the value in config/params/generated_config.php to 'DELETE_SHORT_URL_THRESHOLD' => 100, cleared cache, restarted Nginx, php, tried using different browsers, etc., and the issues still persist on both servers.

Not sure if there is anything else I should do to have the changes take effect?

saiballo commented 2 years ago

very strange... I edit this value in generated_config.php but without effect. I restart apache too...

acelaya commented 2 years ago

very strange... I edit this value in generated_config.php but without effect. I restart apache too...

@saiballo I forgot to tell you also have to delete the data/cache/app_config.php file. Then it will start working.

I have updated my original comment in case I need to reference to it.

[ERROR] No URL found with short code "xxxx" for domain "https://xxx/xxxx"

@dfnsar715 This is an unrelated issue. If you have applied the mitigation described here, you will only be able to delete short URLs not in the default domain, if you explicitly pass the domain with --domain example.com.

The shlink-web-client does this automatically, that's why the error is different.

daddiofaddio commented 2 years ago

After deleting app_config.php, everything works great. Thanks for the quick response and great app!

saiballo commented 2 years ago

everything now runs great! thank you!

shlink is a great software!

acelaya commented 2 years ago

This has now been fixed and will be released with Shlink 3.0.3