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

feat(server): allow named url shortening (#40) #373

Merged
merged 1 commit into from
Dec 7, 2024

Conversation

Vaelatern
Copy link
Contributor

@Vaelatern Vaelatern commented Dec 5, 2024

Description

I ran the filename header through the URL shortening route

Motivation and Context

This lets me use rustypaste to link to a specific link using a specified short name (for ergonomics).

Also fixes #40 by the by.

How Has This Been Tested?

Changelog Entry

### Added

- Enable naming shortened URLs beyond using a random string or the text "url"

-->

Types of Changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation (no code change)
  • Refactor (refactoring production code)
  • Other

Checklist:

  • My code follows the code style of this project.
  • I have updated the documentation accordingly.
  • I have formatted the code with rustfmt.
  • I checked the lints with clippy.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@tessus
Copy link
Collaborator

tessus commented Dec 5, 2024

Thanks for the PR. Can you also please add test cases and fixtures?

@Vaelatern Vaelatern force-pushed the enable-named-url-shortening branch from 00153af to ca2ff07 Compare December 5, 2024 23:07
@Vaelatern
Copy link
Contributor Author

Sure thing! I'm trying to get in lint compliance too.

@tessus
Copy link
Collaborator

tessus commented Dec 5, 2024

There are a few things to fix. The formatting checks, lints, and tests fail. These have to be fixed and new tests should be added that handle your use case.

@Vaelatern Vaelatern force-pushed the enable-named-url-shortening branch 3 times, most recently from 6fdb015 to d718a84 Compare December 5, 2024 23:18
Copy link
Collaborator

@tessus tessus left a comment

Choose a reason for hiding this comment

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

Unfortunately there are still issues with this PR.

May I suggest to go through the checklist?

  • cargo fmt --check --
  • cargo clippy
  • cargo test -- --test-threads 1
  • ./fixtures/test-fixtures.sh

Currently the code does not even compile.

@Vaelatern Vaelatern force-pushed the enable-named-url-shortening branch from d718a84 to c9c0614 Compare December 6, 2024 00:57
@Vaelatern
Copy link
Contributor Author

Vaelatern commented Dec 6, 2024

I've pushed an update now, it passes CI on my own fork. I've also updated the checkboxes in the original message with what I've done.

Copy link
Collaborator

@tessus tessus left a comment

Choose a reason for hiding this comment

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

Nice, this looks good. Thanks.

@tessus
Copy link
Collaborator

tessus commented Dec 6, 2024

@orhun can you please have a look? I promised I would only merge dependency PRs. ;-)

@Vaelatern let's wait for orhun's approval, since he's the owner of the project. I can't merge without his ok.

@Vaelatern
Copy link
Contributor Author

Sounds good!

I just started using this today, noticed this hole, and wanted to contribute a fix.

@Vaelatern
Copy link
Contributor Author

Apparently I need to sign the commits too

@tessus
Copy link
Collaborator

tessus commented Dec 6, 2024

why? nope, you don't. This project does not have a requirement of signed commits.

@tessus
Copy link
Collaborator

tessus commented Dec 6, 2024

oops, yeah. I am sorry. this policy must be new.

@Vaelatern Vaelatern force-pushed the enable-named-url-shortening branch from c9c0614 to e390f46 Compare December 6, 2024 02:01
@Vaelatern
Copy link
Contributor Author

Now pushed with signed commit, both this and #374 (which I'm about to refactor a tiny bit)

@tessus
Copy link
Collaborator

tessus commented Dec 6, 2024

Thanks.

P.S.: We squash the commits in a PR anyway, in which case the resulting commit would be signed, so the message under the merge button was a bit confusing and IMO wrong. It should say that all commits in the PR must be signed.

Copy link
Owner

@orhun orhun left a comment

Choose a reason for hiding this comment

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

Good stuff 💯

Thanks!

@orhun orhun merged commit 03dc194 into orhun:master Dec 7, 2024
9 checks passed
@Vaelatern Vaelatern deleted the enable-named-url-shortening branch December 8, 2024 09:16
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.

Only one URL at a time can be shortened when filenames aren't random
3 participants