-
-
Notifications
You must be signed in to change notification settings - Fork 275
Closed
Labels
Description
When adding at attachment from a URL source (e.g. a pdf on S3) the name of the attachment is not honored. Instead of the specified name, the file name of the resource is used. The workaround is simple - wrap using a named datasource. Something simple like the following worked for me,
private static final class NamedDataSource implements DataSource {
private final DataSource delegate;
private final String name;
NamedDataSource(String name, DataSource delegate) {
this.delegate = requireNonNull(delegate);
this.name = requireNonNull(name);
}
@Override public String getName() {
return name;
}
@Override public String getContentType() {
return delegate.getContentType();
}
@Override public InputStream getInputStream() throws IOException {
return delegate.getInputStream();
}
@Override public OutputStream getOutputStream() throws IOException {
return delegate.getOutputStream();
}
}