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

Attachment's file extension overwritten by resource's invalid extension #151

Closed
bbottema opened this issue Jun 30, 2018 · 2 comments
Closed

Comments

@bbottema
Copy link
Owner

Simple Java Mail tries to use the extension found in the resource name over the provided name. This is to find possible missing or invalid extensions provided manually by looking at the resource itself.

However, this contains a bug where the given extension is overwritten even if the resource's extension is not really an extension at all, in some URL for example:

URL url = new URL("https://booking.skypicker.com/api/v0.1/get_file/1234?file_id=1234&simple_token=abcd1234");
		URLDataSource resource = new URLDataSource(url);
		Email email = EmailBuilder.startingBlank()
				(..)
				.withAttachment("invoice.pdf", resource)
				.buildEmail();

Because of this bug, the invoice.pdf filename is replaced with invoice.pdf.1/get_file/1234?file_id=1234&simple_token=abcd1234.

The current solution is not as smart as realizing .1+rest is not an extension, but it should be smart enough to understand the given filename already has an extension.

@bbottema
Copy link
Owner Author

Released in 6.0.0-rc1.

@bbottema
Copy link
Owner Author

6.0.0 has released as well, finally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant