mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-14 17:26:22 +01:00
Fix source URL creation for SVN
This commit is contained in:
@@ -26,7 +26,7 @@ public abstract class FileObjectMapper extends BaseMapper<FileObject, FileObject
|
|||||||
|
|
||||||
@AfterMapping
|
@AfterMapping
|
||||||
void addLinks(FileObject fileObject, @MappingTarget FileObjectDto dto, @Context NamespaceAndName namespaceAndName, @Context String revision) {
|
void addLinks(FileObject fileObject, @MappingTarget FileObjectDto dto, @Context NamespaceAndName namespaceAndName, @Context String revision) {
|
||||||
String path = fileObject.getPath();
|
String path = removeFirstSlash(fileObject.getPath());
|
||||||
Links.Builder links = Links.linkingTo()
|
Links.Builder links = Links.linkingTo()
|
||||||
.self(addPath(resourceLinks.source().sourceWithPath(namespaceAndName.getNamespace(), namespaceAndName.getName(), revision, ""), path));
|
.self(addPath(resourceLinks.source().sourceWithPath(namespaceAndName.getNamespace(), namespaceAndName.getName(), revision, ""), path));
|
||||||
if (!dto.isDirectory()) {
|
if (!dto.isDirectory()) {
|
||||||
@@ -40,4 +40,8 @@ public abstract class FileObjectMapper extends BaseMapper<FileObject, FileObject
|
|||||||
private String addPath(String sourceWithPath, String path) {
|
private String addPath(String sourceWithPath, String path) {
|
||||||
return URI.create(sourceWithPath).resolve(path).toASCIIString();
|
return URI.create(sourceWithPath).resolve(path).toASCIIString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String removeFirstSlash(String source) {
|
||||||
|
return source.startsWith("/") ? source.substring(1) : source;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user