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

Fix space on end of page name creates two pages, one shadowed #615 #817

Merged
merged 1 commit into from
Mar 23, 2024

Conversation

fflorent
Copy link
Contributor

Context

Fixes #615.

Proposed solution

  1. Disallow PUT on filename with filenames surrounded with spaces;
  2. If the filename provided on GET is surrounded by spaces, redirect to its trimmed version;
  3. In case of required authentication, return a 401 (UNAUTHORIZED) + redirect;

Other

If you want me to create tests, I would like to know if there already exists files places I can put them in.

common/spaces/http_space_primitives.ts Show resolved Hide resolved
@@ -469,6 +470,7 @@ export class HttpServer {
const req = c.req;
const name = req.param("path")!;
const spaceServer = await this.ensureSpaceServer(req);
const mdExt = ".md";
Copy link
Collaborator

Choose a reason for hiding this comment

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

If you introduce constants like this, I'd prefer them at the top level (top of the file, next to authenticationExpirySeconds) for instance.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@zefhemel
Copy link
Collaborator

Sorry for the delay, this looks good. Thanks!

@zefhemel zefhemel merged commit 5a6d7ec into silverbulletmd:main Mar 23, 2024
1 check passed
@fflorent fflorent deleted the fix-615 branch March 24, 2024 19:06
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.

Space on end of page name creates two pages, one shadowed
2 participants