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

Some refactoring #846

Closed
wants to merge 4 commits into from
Closed

Some refactoring #846

wants to merge 4 commits into from

Conversation

cyqsimon
Copy link
Contributor

I saw some rather ugly code so I did some refactoring.

Things of note:

  • Add an empty rustfmt.toml
  • Switch from qrcodegen to qrcode crate for QR code support
    • This is so that we don't have to maintain a bespoke (and rather crude TBH) output implementation
  • I noticed a clear mistake, but I'm not sure how you want to fix it. See code review

@@ -219,10 +219,10 @@ pub fn directory_listing(

// If the `qrcode` parameter is included in the url, then should respond to the QR code
if let Some(url) = query_params.qrcode {
let res = match QrCode::encode_text(&url, QrCodeEcc::Medium) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like someone was in a hurry and overlooked this. url is not actually the URL, so we're basically encoding an arbitrary query value.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But I'm not sure how to fix this. What should this QR code point to, exactly? (Or more broadly, what's the purpose of this QR code?) And if it points to the current URL, should the qrcode query be removed?

@svenstaro
Copy link
Owner

Hey, thanks! Is there any chance to split this up into individual PRs? I especially like the QR Code work.

@cyqsimon
Copy link
Contributor Author

Hey, thanks! Is there any chance to split this up into individual PRs? I especially like the QR Code work.

Yeah sure thing.

@cyqsimon cyqsimon closed this Jul 20, 2022
@cyqsimon cyqsimon deleted the refactor branch July 20, 2022 09:44
@cyqsimon cyqsimon mentioned this pull request Jul 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants