File tree Expand file tree Collapse file tree 2 files changed +5
-3
lines changed
main/java/com/inrupt/client/accessgrant
test/java/com/inrupt/client/accessgrant Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Original file line number Diff line number Diff line change 3737import java .util .HashSet ;
3838import java .util .List ;
3939import java .util .Map ;
40+ import java .util .Objects ;
4041import java .util .Set ;
4142import java .util .stream .Collectors ;
4243
@@ -153,10 +154,10 @@ static AccessRequest parse(final String serialization) throws IOException {
153154 */
154155 public static String template (final String dataPath ) {
155156 Objects .requireNonNull (dataPath , "dataPath may not be null!" );
156- if (!dataPath .startsWith ("/" )) {
157- return "https://{domain}/{+path}/ " + dataPath ;
157+ if (!dataPath .startsWith ("/" ) || dataPath . isBlank () ) {
158+ return template ( "/ " + dataPath ) ;
158159 }
159- return template ( "/ " + dataPath ) ;
160+ return "https://{domain}/{+path} " + dataPath ;
160161 }
161162
162163 /**
Original file line number Diff line number Diff line change @@ -278,6 +278,7 @@ void testTemplate() {
278278 assertEquals ("https://{domain}/{+path}/custom-path" , AccessRequest .template ("custom-path" ));
279279 assertEquals ("https://{domain}/{+path}/custom-path" , AccessRequest .template ("/custom-path" ));
280280 assertEquals ("https://{domain}/{+path}/./custom-path" , AccessRequest .template ("./custom-path" ));
281+ assertEquals ("https://{domain}/{+path}/" , AccessRequest .template ("" ));
281282 }
282283
283284 @ Test
You can’t perform that action at this time.
0 commit comments