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

How to remove trailing slash? #122

Closed
paulocoutinhox opened this issue Nov 12, 2021 · 3 comments
Closed

How to remove trailing slash? #122

paulocoutinhox opened this issue Nov 12, 2021 · 3 comments

Comments

@paulocoutinhox
Copy link

paulocoutinhox commented Nov 12, 2021

Hi,

I made a site with this (https://util123.com/) but i need now remove the last slash.

Can anyone help me?

The main project is Kaktos (https://github.com/paulocoutinhox/kaktos).

Thanks for any help.

@paulocoutinhox
Copy link
Author

Today im using:

@flask_app.route("/<path:path>/")
def page(path=None):
    kaktos = system.get_kaktos(path)
    return render_template(f"pages/{path}.html", kaktos=kaktos)

But if i remove the trailing slash:

@flask_app.route("/<path:path>")
def page(path=None):
    kaktos = system.get_kaktos(path)
    return render_template(f"pages/{path}.html", kaktos=kaktos)

I got this error:

environment mode: development
root dir: /Users/paulo/Developer/workspaces/python/kaktos
build dir: /Users/paulo/Developer/workspaces/python/kaktos/build
template dir: /Users/paulo/Developer/workspaces/python/kaktos/templates
building site...
/usr/local/lib/python3.9/site-packages/flask_frozen/__init__.py:205: MimetypeMismatchWarning: Filename extension of 'gallery' (type application/octet-stream) does not match Content-Type: text/html; charset=utf-8
  return set(page.url for page in self.freeze_yield())
Traceback (most recent call last):
  File "/Users/paulo/Developer/workspaces/python/kaktos/kaktos.py", line 6, in <module>
    system.process_command()
  File "/Users/paulo/Developer/workspaces/python/kaktos/modules/system.py", line 125, in process_command
    run(command_params)
  File "/Users/paulo/Developer/workspaces/python/kaktos/modules/commands/default.py", line 9, in run
    system.build_pages()
  File "/Users/paulo/Developer/workspaces/python/kaktos/modules/system.py", line 81, in build_pages
    freezer_app.freeze()
  File "/usr/local/lib/python3.9/site-packages/flask_frozen/__init__.py", line 205, in freeze
    return set(page.url for page in self.freeze_yield())
  File "/usr/local/lib/python3.9/site-packages/flask_frozen/__init__.py", line 205, in <genexpr>
    return set(page.url for page in self.freeze_yield())
  File "/usr/local/lib/python3.9/site-packages/flask_frozen/__init__.py", line 189, in freeze_yield
    new_filename = self._build_one(url, last_modified)
  File "/usr/local/lib/python3.9/site-packages/flask_frozen/__init__.py", line 372, in _build_one
    with open(filename, 'wb') as fd:
IsADirectoryError: [Errno 21] Is a directory: '/Users/paulo/Developer/workspaces/python/kaktos/build/gallery'

@paulocoutinhox paulocoutinhox changed the title How to remove last slash bar? How to remove trailing slash? Nov 12, 2021
@paulocoutinhox
Copy link
Author

???

@liZe
Copy link
Contributor

liZe commented Nov 12, 2023

It’s probably a duplicate of #85.

@liZe liZe closed this as not planned Won't fix, can't repro, duplicate, stale Nov 12, 2023
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

No branches or pull requests

2 participants