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

404 error when resources URL contains Chinese since 2.6.x #30765

Closed
0604hx opened this issue Apr 21, 2022 · 1 comment
Closed

404 error when resources URL contains Chinese since 2.6.x #30765

0604hx opened this issue Apr 21, 2022 · 1 comment
Labels
for: external-project For an external project and not something we can fix status: duplicate A duplicate of another issue

Comments

@0604hx
Copy link

0604hx commented Apr 21, 2022

Hello! I recently update Spring Boot version to 2.6.6, and got 404 error when access resources which url contains Chinese.

There is no problem rolling back to 2.5.x or below.

My project structure :

image

Here is my code :

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.6.0</version>
</parent>

<properties>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
</properties>

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
</dependencies>
// DemoApp.java
@SpringBootApplication
public class DemoApp {

    public static void main(String[] args) {
        SpringApplication.run(DemoApp.class, args);
    }
}

// MvcConfig.java
@Configuration
public class MvcConfig implements WebMvcConfigurer {

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/attach/**")
                .addResourceLocations("file:attach/");
    }
}

Code run with JDK 1.8 on windows 10 64bit.

URL result
http://localhost:8080/attach/%E5%BC%A0%E9%92%A7%E7%94%AF.png 🔴 404
http://localhost:8080/attach/张钧甯.png 🔴 404
http://localhost:8080/attach/zhangjunning.png

Thanks!

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Apr 21, 2022
@bclozel
Copy link
Member

bclozel commented Apr 21, 2022

Closing as a duplicate of spring-projects/spring-framework#27791

@bclozel bclozel closed this as completed Apr 21, 2022
@bclozel bclozel added status: duplicate A duplicate of another issue for: external-project For an external project and not something we can fix and removed status: waiting-for-triage An issue we've not yet triaged labels Apr 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
for: external-project For an external project and not something we can fix status: duplicate A duplicate of another issue
Projects
None yet
Development

No branches or pull requests

3 participants