Commit e6306860 authored by Andrei Mihu's avatar Andrei Mihu
Browse files

More graceful handling of no-op authoritative storage delete operations.

parent 9508e8fe
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ The format is based on [keep a changelog](http://keepachangelog.com) and this pr
- Fix handling of optional parameters in JS runtime token generate function.
- Ensure group count does not update when failing to add a member.
- Handle Google IAP validation token caching when using credential overrides.
- More graceful handling of no-op authoritative storage delete operations.

## [3.14.0] - 2022-10-14
### Added
+6 −0
Original line number Diff line number Diff line
@@ -674,6 +674,12 @@ func StorageDeleteObjects(ctx context.Context, logger *zap.Logger, db *sql.DB, a
				return err
			}

			if authoritativeDelete && op.ObjectID.GetVersion() == "" {
				// If it's an authoritative delete and there is no OCC, the only reason rows affected would be 0 is having
				// nothing to delete. In that case it's safe to assume the deletion was just a no-op and there's no need
				// to check anything further. Should apply something similar to non-authoritative deletes too.
				continue
			}
			if rowsAffected, _ := result.RowsAffected(); rowsAffected == 0 {
				return StatusError(codes.InvalidArgument, "Storage delete rejected.", errors.New("Storage delete rejected - not found, version check failed, or permission denied."))
			}