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

mailpit.svg file not found when webroot is set #441

Closed
Lyrkan opened this issue Feb 12, 2025 · 7 comments
Closed

mailpit.svg file not found when webroot is set #441

Lyrkan opened this issue Feb 12, 2025 · 7 comments

Comments

@Lyrkan
Copy link

Lyrkan commented Feb 12, 2025

Hi there,

Since version 1.22.2 it seems that the mailpit.svg file cannot be loaded when using a webroot.

Using v1.22.2 without a webroot:

services:
  mailpit:
    image: axllent/mailpit:v1.22.2
    ports:
      - '8025:8025'
$ curl http://127.0.0.1:8025/mailpit.svg
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
   width="500"
   height="460"
(...)

Using v1.22.2 with a webroot:

services:
  mailpit:
    image: axllent/mailpit:v1.22.2
    ports:
      - '8025:8025'
    environment:
      MP_WEBROOT: '/mailpit/'
$ curl http://127.0.0.1:8025/mailpit/mailpit.svg
File not found

Using v1.22.1 with a webroot:

services:
  mailpit:
    image: axllent/mailpit:v1.22.1
    ports:
      - '8025:8025'
    environment:
      MP_WEBROOT: '/mailpit/'
$ curl http://127.0.0.1:8025/mailpit/mailpit.svg
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
   width="500"
   height="460"
(...)
@NADEE-MJ
Copy link

I was seeing this as well when using the binary. Installed via the installer on Ubuntu and also generated the binary from the go code using the guide and same result.

@axllent
Copy link
Owner

axllent commented Feb 12, 2025

Sounds like a bug. Thanks for reporting, I'll look into this soon.

@axllent
Copy link
Owner

axllent commented Feb 13, 2025

I found the issue, which was caused in this case by the fact that both your webroot and the filename start with "mailpit"... It was "trimming" /mailpit off the virtual path to the file, however it did it multiple times, so /mailpit/mailpit.svg became just .svg 🤦

I have pushed a fix for this, however it hasn't yet been released as I try not release new versions too often (package maintainers get grumpy when I create extra work for them). Is this bug affecting just you, or is it impacting a wider audience (part of a larger Mailpit implementation)?

@NADEE-MJ
Copy link

NADEE-MJ commented Feb 13, 2025

Just a heads up I was seeing the same issue with web root set to mail. Not sure if the fix will work for that case as well. The app is still fully usable just an annoying 404.

@axllent
Copy link
Owner

axllent commented Feb 13, 2025

Yes, /mail/mailpit.svg would have resulted in pit.svg. I can confirm that this is solved in the bugfix I pushed. My question (to you both) is how big is the impact of this bug for you? If it affects a larger audience then I can release a new version now, otherwise I will wait a couple more days (weekend).

@Lyrkan
Copy link
Author

Lyrkan commented Feb 13, 2025

I have pushed a fix for this, however it hasn't yet been released as I try not release new versions too often (package maintainers get grumpy when I create extra work for them). Is this bug affecting just you, or is it impacting a wider audience (part of a larger Mailpit implementation)?

It can wait, don't worry :)

@axllent
Copy link
Owner

axllent commented Feb 15, 2025

This fix has now been released in v1.22.3. Thanks for reporting the issue!

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

3 participants