szabodanika / microbin

A secure, configurable file-sharing and URL shortening web app written in Rust.
https://microbin.eu
BSD 3-Clause "New" or "Revised" License
2.71k stars 172 forks source link

Add custom URL support #253

Open OXeu opened 8 months ago

OXeu commented 8 months ago

Support https://github.com/szabodanika/microbin/issues/83

What changed

Why replace pasta.id == id

There are a large number of statements in the code that compare pasta.id == id, and implementing custom URL inevitably introduces additional fields, requiring a large number of duplicate judgments to be written at all positions. Therefore, I choose to extract the comparison logic into a lambda function to reduce duplicate code.

Todo

Custom URL validity check.