Skip to content

Commit

Permalink
String endpoint instead of appending during prefix comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
vikrambohra committed Nov 19, 2024
1 parent abbf68b commit e15e1dc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -193,24 +193,16 @@ private Optional<UUID> extractUUIDFromRequestBody(
}

Storage storage = catalog.resolveStorage(TableIdentifier.of(databaseId, tableId));
java.nio.file.Path databaseDirPath;
if (StringUtils.isNotEmpty(storage.getClient().getEndpoint())) {
databaseDirPath =
Paths.get(
storage.getClient().getEndpoint(), storage.getClient().getRootPrefix(), databaseId);
} else {
databaseDirPath = Paths.get(storage.getClient().getRootPrefix(), databaseId);
}

java.nio.file.Path databaseDirPath = Paths.get(storage.getClient().getRootPrefix(), databaseId);
;
String manifestListKey = "manifest-list";
java.nio.file.Path manifestListPath;
try {
manifestListPath =
Paths.get(
new Gson()
.fromJson(snapshotStr, JsonObject.class)
.get(manifestListKey)
.getAsString());
String manifestListPathString =
new Gson().fromJson(snapshotStr, JsonObject.class).get(manifestListKey).getAsString();
manifestListPathString =
StringUtils.removeStart(manifestListPathString, storage.getClient().getEndpoint());
manifestListPath = Paths.get(manifestListPathString);
} catch (Exception exception) {
throw new RequestValidationFailureException(
String.format(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ private String getTableLocation(
String tableLocationWithoutEndpoint =
String.format("%s/%s/%s-%s", rootPrefix, databaseId, tableId, tableUUID.toString());
if (StringUtils.isNotEmpty(endPoint)) {
return String.format("%s/%s", endPoint, tableLocationWithoutEndpoint);
return String.format("%s%s", endPoint, tableLocationWithoutEndpoint);
}

return tableLocationWithoutEndpoint;
Expand Down

0 comments on commit e15e1dc

Please sign in to comment.