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

Change order of SUFFIXES so index.html is served first #3388

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

RichGibson
Copy link

A file named .html should not exist in the output directory.

Somehow I ended up with one, and it was difficult to debug. Changing the order of the SUFFIXES allows the index.html file to be served before checking for .html.

… '.html' exists.

A file named .html should not exist in output. But somehow I ended up with one, and it was difficult to debug. Changing the order of the SUFFIXES allows the index.html file to be served before checking for .html.
Copy link
Member

@pauloxnet pauloxnet left a comment

Choose a reason for hiding this comment

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

There's some test to update to merge this fix?

@RichGibson
Copy link
Author

I am not sure what the test would look like, I'm sorry.

@boxydog
Copy link
Contributor

boxydog commented Nov 3, 2024

I don't understand why this pull request didn't run tests. When it runs test_server.py I believe it will fail due to these lines:

            # foo.html has precedence over foo/index.html
            path = handler.get_path_that_exists("foo" + suffix)
            self.assertEqual(path, "foo.html")

It failed when I ran it locally.

To prevent your issue, you might have to do something more complicated, such as "if foo is a directory, then look for index.html first"? I don't understand get_path_that_exists deeply.

@boxydog
Copy link
Contributor

boxydog commented Nov 3, 2024

FYI the test failure on my box:

        for suffix in ["", "/"]:
            # foo.html has precedence over foo/index.html
            path = handler.get_path_that_exists("foo" + suffix)
>           self.assertEqual(path, "foo.html")
E           AssertionError: 'foo/index.html' != 'foo.html'
E           - foo/index.html
E           ?    ------
E           + foo.html

pelican/tests/test_server.py:48: AssertionError
=========================== short test summary info ============================
FAILED pelican/tests/test_server.py::TestServer::test_get_path_that_exists - ...

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.

3 participants