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

Invalid character '/' for PATH_SEGMENT in "/notify.png" #5253

Closed
guqing opened this issue Jan 26, 2024 · 2 comments · Fixed by #5256
Closed

Invalid character '/' for PATH_SEGMENT in "/notify.png" #5253

guqing opened this issue Jan 26, 2024 · 2 comments · Fixed by #5256
Labels
area/core Issues or PRs related to the Halo Core kind/bug Categorizes issue or PR as related to a bug.
Milestone

Comments

@guqing
Copy link
Member

guqing commented Jan 26, 2024

What happened?

当 logo 的路径以 / 开头时会出现如标题所述异常,应该是由于 #5148 改动所致

问题出现在:

// indicate the logo is a path
logo = UriComponentsBuilder.newInstance()
.pathSegment("plugins", pluginName, "assets", specLogo)
.queryParam("version", pluginVersion)
.build(true)
.toString();

能复现问题的插件: https://github.com/monyuan/notify-me

点击查看异常信息
java.lang.IllegalArgumentException: Invalid character '/' for PATH_SEGMENT in "/notify.png"
	at org.springframework.web.util.HierarchicalUriComponents.verifyUriComponent(HierarchicalUriComponents.java:422) ~[spring-web-6.1.3.jar:6.1.3]
	at org.springframework.web.util.HierarchicalUriComponents$PathSegmentComponent.verify(HierarchicalUriComponents.java:974) ~[spring-web-6.1.3.jar:6.1.3]
	at org.springframework.web.util.HierarchicalUriComponents.verify(HierarchicalUriComponents.java:386) ~[spring-web-6.1.3.jar:6.1.3]
	at org.springframework.web.util.HierarchicalUriComponents.<init>(HierarchicalUriComponents.java:146) ~[spring-web-6.1.3.jar:6.1.3]
	at org.springframework.web.util.UriComponentsBuilder.buildInternal(UriComponentsBuilder.java:445) ~[spring-web-6.1.3.jar:6.1.3]
	at org.springframework.web.util.UriComponentsBuilder.build(UriComponentsBuilder.java:433) ~[spring-web-6.1.3.jar:6.1.3]
	at run.halo.app.core.extension.reconciler.PluginReconciler.resolveStaticResources(PluginReconciler.java:254) ~[classes/:na]
	at run.halo.app.core.extension.reconciler.PluginReconciler.lambda$reconcile$0(PluginReconciler.java:116) ~[classes/:na]
	at java.base/java.util.Optional.map(Optional.java:260) ~[na:na]
	at run.halo.app.core.extension.reconciler.PluginReconciler.reconcile(PluginReconciler.java:96) ~[classes/:na]
	at run.halo.app.core.extension.reconciler.PluginReconciler.reconcile(PluginReconciler.java:65) ~[classes/:na]
	at run.halo.app.extension.controller.DefaultController$Worker.run(DefaultController.java:163) ~[classes/:na]
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) ~[na:na]
	at java.base/java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:264) ~[na:na]
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java) ~[na:na]
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[na:na]
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[na:na]
	at java.base/java.lang.Thread.run(Thread.java:840) ~[na:na]

Additional information

/kind bug
/area core
/milestone 2.12.x

@f2c-ci-robot f2c-ci-robot bot added the kind/bug Categorizes issue or PR as related to a bug. label Jan 26, 2024
@f2c-ci-robot f2c-ci-robot bot added this to the 2.12.x milestone Jan 26, 2024
@f2c-ci-robot f2c-ci-robot bot added the area/core Issues or PRs related to the Halo Core label Jan 26, 2024
@JohnNiang
Copy link
Member

这里需要确认一下 logo 的规则:

  1. HTTP URL. e.g.: https://www.halo.run/logo.
  2. Relative Path to resources folder. e.g.: /logo.png, logo.png
  3. Image data URL. e.g.: data:image/png;xxx

/ping @halo-dev/sig-halo

@guqing
Copy link
Member Author

guqing commented Jan 26, 2024

这里需要确认一下 logo 的规则:

  1. HTTP URL. e.g.: halo.run/logo.
  2. Relative Path to resources folder. e.g.: /logo.png, logo.png/a/b/v/d/logo.png
  3. Image data URL. e.g.: data:image/png;xxx

/ping @halo-dev/sig-halo

是的

f2c-ci-robot bot pushed a commit that referenced this issue Jan 26, 2024
#### What type of PR is this?

/kind bug
/area core
/milestone 2.12.x

#### What this PR does / why we need it:

This PR treats logo as a path when building logo HTTP URL instead of a path segment. The concrete rules of logo is described [here](#5253 (comment)).

See #5253 for more.

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

Fixes #5253

#### Does this PR introduce a user-facing change?

```release-note
None
```
@JohnNiang JohnNiang modified the milestones: 2.12.x, 2.12.0 Jan 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/core Issues or PRs related to the Halo Core kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants