diff --git a/ccm-core/src/main/java/org/libreccm/api/themes/Themes.java b/ccm-core/src/main/java/org/libreccm/api/themes/Themes.java index 218ab2f49..c0d7b76d3 100644 --- a/ccm-core/src/main/java/org/libreccm/api/themes/Themes.java +++ b/ccm-core/src/main/java/org/libreccm/api/themes/Themes.java @@ -412,6 +412,44 @@ public class Themes implements Serializable { } } + /** + * Gets the {@link ThemeFileInfo} for a file from the theme. + * + * @param themeName The name of the theme. + * @param path The path of the file to retrieve. + * + * @return The content of the requsted file. + */ + @GET + @Path("/themes/{theme}/files/{path:.+}/@info") + @AuthorizationRequired + @RequiresPrivilege(ThemingPrivileges.EDIT_THEME) + public ThemeFileInfo getThemeFileInfo( + @PathParam("theme") final String themeName, + @PathParam("path") final String path + ) { + final ThemeProvider provider = findProvider(themeName) + .orElseThrow( + () -> new NotFoundException( + String.format( + "Theme \"%s\" does not exist.", themeName + ) + ) + ); + + return provider + .getThemeFileInfo(themeName, ThemeVersion.DRAFT, path) + .orElseThrow( + () -> new NotFoundException( + String.format( + "File \"%s\" does not exist in theme %s.", + path, + themeName + ) + ) + ); + } + /** * Creates or updates a file in a theme. *