mirror of
https://github.com/google/nomulus.git
synced 2025-05-13 16:07:15 +02: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:
parent
2569d62b0a
commit
44546a3480
1 changed files with 2 additions and 0 deletions
|
@ -18,6 +18,7 @@ import static com.google.common.base.Preconditions.checkArgument;
|
||||||
import static google.registry.model.ofy.ObjectifyService.ofy;
|
import static google.registry.model.ofy.ObjectifyService.ofy;
|
||||||
import static google.registry.util.DateTimeUtils.END_OF_TIME;
|
import static google.registry.util.DateTimeUtils.END_OF_TIME;
|
||||||
import static google.registry.util.DateTimeUtils.START_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 static org.joda.time.DateTimeZone.UTC;
|
||||||
|
|
||||||
import com.beust.jcommander.Parameter;
|
import com.beust.jcommander.Parameter;
|
||||||
|
@ -63,6 +64,7 @@ final class GetHistoryEntriesCommand implements RemoteApiCommand {
|
||||||
type != null && uniqueId != null,
|
type != null && uniqueId != null,
|
||||||
"If either of 'type' or 'id' are set then both must be");
|
"If either of 'type' or 'id' are set then both must be");
|
||||||
parentKey = type.getKey(uniqueId, DateTime.now(UTC));
|
parentKey = type.getKey(uniqueId, DateTime.now(UTC));
|
||||||
|
checkArgumentNotNull(parentKey, "Invalid resource ID");
|
||||||
}
|
}
|
||||||
for (HistoryEntry entry :
|
for (HistoryEntry entry :
|
||||||
(parentKey == null
|
(parentKey == null
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue