spring-cloud-config icon indicating copy to clipboard operation
spring-cloud-config copied to clipboard

useDefaultLabel not working to get resources

Open mrodal opened this issue 1 year ago • 3 comments

Describe the bug

In org.springframework.cloud.config.server.resource.ResourceController there are some methods that use a parameter useDefaultLabel to differentiate from the others. This is not working, when running /name/profile/some/file?useDefaultLabel the request is handled by the wrong method, the one that receives a label, and takes some as the label

mrodal avatar Jul 23 '24 19:07 mrodal

Can you be more specific about which method you believe should be handling that request and which one is actually handling the request? Can you provide a sample?

ryanjbaxter avatar Jul 24 '24 13:07 ryanjbaxter

Sure, specifically its being handled by

	@GetMapping("/{name}/{profile}/{label}/**")
	public String retrieve(@PathVariable String name, @PathVariable String profile, @PathVariable String label,
			ServletWebRequest request, @RequestParam(defaultValue = "true") boolean resolvePlaceholders)
			throws IOException {
		String path = getFilePath(request, name, profile, label);
		return retrieve(request, name, profile, label, path, resolvePlaceholders);
	}

But it should be handled by

	@GetMapping(value = "/{name}/{profile}/{path:.*}", params = "useDefaultLabel")
	public String retrieveDefault(@PathVariable String name, @PathVariable String profile, @PathVariable String path,
			ServletWebRequest request, @RequestParam(defaultValue = "true") boolean resolvePlaceholders)
			throws IOException {
		return retrieve(request, name, profile, null, path, resolvePlaceholders);
	}

See, the objective is to hit the endpoint that uses the default label configured in the config server

mrodal avatar Jul 24 '24 14:07 mrodal

Maybe I am missing something, but what class are these methods in?

ryanjbaxter avatar Aug 23 '24 15:08 ryanjbaxter

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

spring-cloud-issues avatar Aug 30 '24 15:08 spring-cloud-issues

Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.

spring-cloud-issues avatar Sep 06 '24 15:09 spring-cloud-issues