mirror of https://github.com/halo-dev/halo
fix: incorrect truncation of CSS resource reads (#4678)
#### 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 内容被错误拆分导致无法加载的问题 ```pull/4688/head^2
parent
40565f1f32
commit
d443c3ed29
|
@ -26,7 +26,6 @@ import org.springframework.core.io.buffer.DefaultDataBufferFactory;
|
||||||
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
|
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
import org.springframework.util.StreamUtils;
|
|
||||||
import org.springframework.web.server.ServerWebInputException;
|
import org.springframework.web.server.ServerWebInputException;
|
||||||
import reactor.core.Exceptions;
|
import reactor.core.Exceptions;
|
||||||
import reactor.core.publisher.Flux;
|
import reactor.core.publisher.Flux;
|
||||||
|
@ -179,9 +178,15 @@ public class PluginServiceImpl implements PluginService {
|
||||||
return BundleResourceUtils.getJsBundleResource(pluginManager, pluginName,
|
return BundleResourceUtils.getJsBundleResource(pluginManager, pluginName,
|
||||||
BundleResourceUtils.CSS_BUNDLE);
|
BundleResourceUtils.CSS_BUNDLE);
|
||||||
})
|
})
|
||||||
.flatMap(resource -> DataBufferUtils.read(resource,
|
.flatMap(resource -> {
|
||||||
DefaultDataBufferFactory.sharedInstance, StreamUtils.BUFFER_SIZE)
|
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
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue