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

Server: actually return MIME type #2928

Closed
wants to merge 2 commits into from

Conversation

MinchinWeb
Copy link
Contributor

@MinchinWeb MinchinWeb commented Oct 2, 2021

The original paths being provided had a tailing slash, and so everything was returning as "application/octet-stream" (at least on Windows)

Pull Request Checklist

Resolves: #2880

Refer to that issue for the discussion.

  • Ensured tests pass and (if applicable) updated functional test output
  • Conformed to code style guidelines by running appropriate linting tools
  • [ n/a ] Added tests for changed code
  • [ n/a ] Updated documentation for changed code

P.S. If this could be marked "hacktoberfest-accepted" (so it counts towards my Hacktoberfest Pull Requests), that would be appreciated!

The original paths being provided had a tailing slash, and so everything was returning as "application/octet-stream" (at least on Windows)
pelican/server.py Outdated Show resolved Hide resolved
Otherwise, we might strip the "root" / off Unix pathes
@MinchinWeb
Copy link
Contributor Author

@avaris The issue here seems to have been fixed between the 4.7.0 release and now; I suspect by #2931 (because that's the only thing that's touched the server module). As it stands right now, the master branch is returning the MIME types as expected.

So either close this as no longer needed, or maybe these changes are still helpful anyway.

@avaris
Copy link
Member

avaris commented Oct 6, 2021

I suppose we should close this. I'm still curious where that extra / came from, though. If #2931 helped this issue, I'm slightly puzzled. Does your python return True for os.path.exists("file.css/") provided that there is a file.css in the same folder? It should not, normally...

@MinchinWeb
Copy link
Contributor Author

I'm not really sure what was causing the issues... os.path.exists("file.css/") seems to return False (as expected). I think it was mistakenly adding the / to paths it wasn't supposed to, but I could never catch it in action, which is why this PR worked by pulling it off when trying to determine MIME types.

I'll close this.

@MinchinWeb MinchinWeb closed this Oct 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Built-in Server doesn't serve CSS on Windows
3 participants