Skip to content

Commit

Permalink
IIIF characters ^ & !
Browse files Browse the repository at this point in the history
  • Loading branch information
pavel-stastny committed Apr 2, 2024
1 parent 8fe81dd commit 8176679
Showing 1 changed file with 15 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1171,16 +1171,12 @@ public Response tile(@PathParam("pid") String pid,
String firstVal = split[0];
String secondVal = split[1];

if (firstVal.startsWith("^")) {
firstVal = firstVal.substring(1);
}
firstVal = iiifPrefix(firstVal);
secondVal = iiifPrefix(secondVal);

if (firstVal.startsWith("!")) {
firstVal = firstVal.substring(1);
}
try {
int width = Integer.parseInt(firstVal);
int height = Integer.parseInt(secondVal);
int width = StringUtils.isAnyString(firstVal) ? Integer.parseInt(firstVal) : 0;
int height = StringUtils.isAnyString(secondVal) ? Integer.parseInt(secondVal) :0;
if (width > MAX_TIME_SIZE || height > MAX_TIME_SIZE) {
checkUserIsAllowedToReadObject(pid);
}
Expand Down Expand Up @@ -1227,6 +1223,17 @@ public Response tile(@PathParam("pid") String pid,
}
}

private String iiifPrefix(String firstVal) {
if (firstVal.startsWith("^")) {
firstVal = firstVal.substring(1);
}

if (firstVal.startsWith("!")) {
firstVal = firstVal.substring(1);
}
return firstVal;
}

@GET
@Path("{pid}/introspect")
@Produces(MediaType.APPLICATION_JSON + ";charset=utf-8")
Expand Down

0 comments on commit 8176679

Please sign in to comment.