mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-11 07:55:47 +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
|
||||
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()
|
||||
.self(addPath(resourceLinks.source().sourceWithPath(namespaceAndName.getNamespace(), namespaceAndName.getName(), revision, ""), path));
|
||||
if (!dto.isDirectory()) {
|
||||
@@ -40,4 +40,8 @@ public abstract class FileObjectMapper extends BaseMapper<FileObject, FileObject
|
||||
private String addPath(String sourceWithPath, String path) {
|
||||
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