You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hop.apache.org by ha...@apache.org on 2026/04/02 20:06:45 UTC
(hop) branch main updated: google storage delete hardening. fixes 6935 (#6939)
This is an automated email from the ASF dual-hosted git repository.
hansva pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/hop.git
The following commit(s) were added to refs/heads/main by this push:
new d99c9d0c15 google storage delete hardening. fixes 6935 (#6939)
d99c9d0c15 is described below
commit d99c9d0c15ff99879ec6a3e47123a37eeee45fbb
Author: Bart Maertens <ba...@know.bi>
AuthorDate: Thu Apr 2 20:06:40 2026 +0000
google storage delete hardening. fixes 6935 (#6939)
---
.../apache/hop/vfs/gs/GoogleStorageFileObject.java | 21 ++++++++++++++++-----
1 file changed, 16 insertions(+), 5 deletions(-)
diff --git a/plugins/tech/google/src/main/java/org/apache/hop/vfs/gs/GoogleStorageFileObject.java b/plugins/tech/google/src/main/java/org/apache/hop/vfs/gs/GoogleStorageFileObject.java
index 660d9c0220..432807cc81 100644
--- a/plugins/tech/google/src/main/java/org/apache/hop/vfs/gs/GoogleStorageFileObject.java
+++ b/plugins/tech/google/src/main/java/org/apache/hop/vfs/gs/GoogleStorageFileObject.java
@@ -231,11 +231,16 @@ public class GoogleStorageFileObject extends AbstractFileObject<GoogleStorageFil
@Override
protected void doDelete() throws Exception {
- if (!hasObject()) {
- throw new IOException("Object is not attached");
- }
- if (!blob.delete()) {
- throw new IOException("Failed to delete object '" + this + "' (not found)");
+ if (hasObject()) {
+ blob.delete();
+ } else if (bucketName != null
+ && !bucketName.isEmpty()
+ && bucketPath != null
+ && !bucketPath.isEmpty()) {
+ Storage storage = getAbstractFileSystem().setupStorage();
+ storage.delete(BlobId.of(bucketName, stripLeadingSlash(bucketPath)));
+ } else {
+ throw new IOException("Cannot delete: missing bucket/object path for '" + this + "'");
}
getAbstractFileSystem().invalidateListCacheForParentOf(bucketName, bucketPath);
}
@@ -249,6 +254,12 @@ public class GoogleStorageFileObject extends AbstractFileObject<GoogleStorageFil
cachedLastModified = null;
}
+ @Override
+ protected boolean doSetLastModifiedTime(long modTime) throws Exception {
+ // GCS objects are immutable. Returning true keeps modified time identical to created time.
+ return true;
+ }
+
@Override
protected long doGetLastModifiedTime() throws Exception {
if (cachedLastModified != null && !Instant.EPOCH.equals(cachedLastModified)) {