Skip to content

Commit

Permalink
fix: incorrect truncation of CSS resource reads (#4678)
Browse files Browse the repository at this point in the history
#### What type of PR is this?
/kind bug
/area core
/milestone 2.10.x

#### What this PR does / why we need it:
修复插件 css bundle 内容被错误拆分导致无法加载的问题

#### Which issue(s) this PR fixes:
Fixes #4677

#### Does this PR introduce a user-facing change?
```release-note
修复插件 css bundle 内容被错误拆分导致无法加载的问题
```
  • Loading branch information
guqing committed Oct 7, 2023
1 parent 40565f1 commit d443c3e
Showing 1 changed file with 9 additions and 4 deletions.
Expand Up @@ -26,7 +26,6 @@
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.stereotype.Component;
import org.springframework.util.Assert;
import org.springframework.util.StreamUtils;
import org.springframework.web.server.ServerWebInputException;
import reactor.core.Exceptions;
import reactor.core.publisher.Flux;
Expand Down Expand Up @@ -179,9 +178,15 @@ public Flux<DataBuffer> uglifyCssBundle() {
return BundleResourceUtils.getJsBundleResource(pluginManager, pluginName,
BundleResourceUtils.CSS_BUNDLE);
})
.flatMap(resource -> DataBufferUtils.read(resource,
DefaultDataBufferFactory.sharedInstance, StreamUtils.BUFFER_SIZE)
);
.flatMap(resource -> {
try {
return DataBufferUtils.read(resource, DefaultDataBufferFactory.sharedInstance,
(int) resource.contentLength());
} catch (IOException e) {
log.error("Failed to read plugin css bundle resource", e);
return Flux.empty();
}
});
}

@Override
Expand Down

0 comments on commit d443c3e

Please sign in to comment.