Skip to content

Commit

Permalink
Fix the problem of not being able to paste image in editor
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnNiang committed Aug 13, 2024
1 parent ec2ad22 commit f031e08
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
import run.halo.app.core.extension.attachment.Constant;
import run.halo.app.core.extension.attachment.Policy;
import run.halo.app.core.extension.attachment.endpoint.AttachmentHandler;
import run.halo.app.core.extension.attachment.endpoint.SimpleFilePart;
import run.halo.app.extension.ConfigMap;
import run.halo.app.extension.Metadata;
import run.halo.app.extension.ReactiveExtensionClient;
Expand Down Expand Up @@ -122,9 +121,10 @@ public Mono<Attachment> upload(UploadContext uploadContext) {
Map.of(Constant.EXTERNAL_LINK_ANNO_KEY, ""));

var spec = new Attachment.AttachmentSpec();
SimpleFilePart simpleFilePart = (SimpleFilePart) file;
spec.setDisplayName(simpleFilePart.filename());
spec.setMediaType(simpleFilePart.mediaType().toString());
spec.setDisplayName(file.filename());
Optional.ofNullable(file.headers().getContentType())
.map(Objects::toString)
.ifPresent(spec::setMediaType);
spec.setSize(fileSize);

var attachment = new Attachment();
Expand Down

0 comments on commit f031e08

Please sign in to comment.