mirror of
https://github.com/scm-manager/scm-manager.git
synced 2026-02-05 14:19:18 +01:00
Render images from repository correctly
This adds a markdown renderer for images, so that images that are referenced by their repository path are resolved correctly. In this case, the content rest endpoint is rendered as source url. For this, two new contexts (RepositoryContext and RepositoryRevisionContext) have been added, that make the repository and the current revision available, so that the content url can be resolved properly. These new contexts may be used by plugins like the scm-readme-plugin. Co-authored-by: Eduard Heimbuch <eduard.heimbuch@cloudogu.com> Reviewed-by: Eduard Heimbuch <eduard.heimbuch@cloudogu.com>
This commit is contained in:
committed by
SCM-Manager
parent
6ba792e5bc
commit
f2f2f29791
@@ -170,6 +170,7 @@ public abstract class RepositoryToRepositoryDtoMapper extends BaseMapper<Reposit
|
||||
}
|
||||
linksBuilder.single(link("changesets", resourceLinks.changeset().all(repository.getNamespace(), repository.getName())));
|
||||
linksBuilder.single(link("sources", resourceLinks.source().selfWithoutRevision(repository.getNamespace(), repository.getName())));
|
||||
linksBuilder.single(link("content", resourceLinks.source().content(repository.getNamespace(), repository.getName())));
|
||||
linksBuilder.single(link("paths", resourceLinks.repository().paths(repository.getNamespace(), repository.getName())));
|
||||
if (RepositoryPermissions.healthCheck(repository).isPermitted() && !healthCheckService.checkRunning(repository)) {
|
||||
linksBuilder.single(link("runHealthCheck", resourceLinks.repository().runHealthCheck(repository.getNamespace(), repository.getName())));
|
||||
|
||||
@@ -780,6 +780,12 @@ class ResourceLinks {
|
||||
public String content(String namespace, String name, String revision, String path) {
|
||||
return addPath(sourceLinkBuilder.method("getRepositoryResource").parameters(namespace, name).method("content").parameters().method("get").parameters(revision, "").href(), path);
|
||||
}
|
||||
|
||||
public String content(String namespace, String name) {
|
||||
return content(namespace, name, "_REVISION_", "_PATH_")
|
||||
.replace("_REVISION_", "{revision}")
|
||||
.replace("_PATH_", "{path}");
|
||||
}
|
||||
}
|
||||
|
||||
public AnnotateLinks annotate() {
|
||||
|
||||
Reference in New Issue
Block a user