mirror of
https://github.com/google/nomulus
synced 2026-01-08 15:21:46 +00:00
Throw error in get_history_entries if the specified ID is invalid
Currently, if the ID is invalid, parentKey is set to null, causing it to return all history entries. Note that there is still a problem that you cannot look up history entries for entities which have been soft deleted, because the foreign key lookup won't work. That is unfortunate, but at least this simple fix makes things better than they were. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=154564262
This commit is contained in:
@@ -18,6 +18,7 @@ import static com.google.common.base.Preconditions.checkArgument;
|
||||
import static google.registry.model.ofy.ObjectifyService.ofy;
|
||||
import static google.registry.util.DateTimeUtils.END_OF_TIME;
|
||||
import static google.registry.util.DateTimeUtils.START_OF_TIME;
|
||||
import static google.registry.util.PreconditionsUtils.checkArgumentNotNull;
|
||||
import static org.joda.time.DateTimeZone.UTC;
|
||||
|
||||
import com.beust.jcommander.Parameter;
|
||||
@@ -63,6 +64,7 @@ final class GetHistoryEntriesCommand implements RemoteApiCommand {
|
||||
type != null && uniqueId != null,
|
||||
"If either of 'type' or 'id' are set then both must be");
|
||||
parentKey = type.getKey(uniqueId, DateTime.now(UTC));
|
||||
checkArgumentNotNull(parentKey, "Invalid resource ID");
|
||||
}
|
||||
for (HistoryEntry entry :
|
||||
(parentKey == null
|
||||
|
||||
Reference in New Issue
Block a user