spring-projects / spring-framework

Spring Framework
https://spring.io/projects/spring-framework
Apache License 2.0
56.77k stars 38.16k forks source link

Artifactory - Bad header value content-type of pom.xml from repo.spring.io/artifactory/snapshot #32304

Closed greggy-laloutre closed 9 months ago

greggy-laloutre commented 9 months ago

We are not able to download pom.xml files from the snapshot repository of repo.spring.io with our updated 'Sonatype Nexus Repository' due to an invalid header value for content-type returned by Artifactory.

2024-02-14 06:46:54,705+0000 WARN [xxx] UNKNOWN org.sonatype.nexus.repository.storage.StorageTxImpl - An exception occurred determining the content type of asset org/springframework/ai/spring-ai-openai-spring-boot-starter/0.8.0-SNAPSHOT/spring-ai-openai-spring-boot-starter-0.8.0-20240214.061929-153.pom in repository maven_proxy_repo.spring.io-snapshot

2024-02-14 06:46:54,708+0000 WARN [xxx] UNKNOWN org.sonatype.nexus.repository.view.handlers.ExceptionHandler - Invalid content: GET /org/springframework/ai/spring-ai-openai-spring-boot-starter/0.8.0-SNAPSHOT/spring-ai-openai-spring-boot-starter-0.8.0-20240214.061929-153.pom: org.sonatype.nexus.repository.InvalidContentException: Content type could not be determined: application/x-maven-pom xml

curl -L -v "https://repo.spring.io/artifactory/snapshot/org/springframework/ai/spring-ai-openai-spring-boot-starter/0.8.0-SNAPSHOT/spring-ai-openai-spring-boot-starter-0.8.0-20240220.195606-169.pom" > /dev/null < "content-type: application/x-maven-pom xml"

Note that there is a space in the value. According to RFC, that is not legal: https://www.w3.org/Protocols/rfc1341/4_Content-Type.html

According to Nexus Documentation, the correct value could be "content-type: application/x-maven-pom"

Since the header value does not respect the RFC, we cannot override configuration of our Nexus Repository to accept a such mime-type value

The milestone repository (https://repo.spring.io/artifactory/milestone/) send a valid header value "content-type: application/x-maven-pom+xml" according to the RFC

bclozel commented 9 months ago

@greggy-laloutre I think you should report this to the spring-ai project, not Spring Framework.

Our SNAPSHOT artifacts seem fine:

curl -L -v "https://repo.spring.io/artifactory/snapshot/org/springframework/spring-core/6.2.0-SNAPSHOT/spring-core-6.2.0-20240221.092646-40.pom" > /dev/null

< Content-Type: application/x-maven-pom+xml