diff --git a/other/java/client/src/main/java/seaweedfs/client/ExtendedFormatUtil.java b/other/java/client/src/main/java/seaweedfs/client/ExtendedFormatUtil.java
new file mode 100644
index 000000000..139c86f6d
--- /dev/null
+++ b/other/java/client/src/main/java/seaweedfs/client/ExtendedFormatUtil.java
@@ -0,0 +1,50 @@
+package seaweedfs.client;
+
+import com.google.protobuf.ByteString;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * A tool class for uniformly formatting the keys of Entry's ExtendedMap
@date 2024/4/9 10:44
+ * Process "Seaweed-" prefix, consistent with http upload file situation
+ *
+ *
+ * Premise:
+ *
+ * curl -H "Seaweed-name1: value1" -F file=to/path "http://localhost:8888/"
+ *
+ * When uploading files using Http, you must add the "Seaweed-" prefix to the key of Extended. As shown above,
+ * the final storage result is Seaweed-name1, The name of key that actual users understand should be name1
+ *
+ * The key of Extended is not forced to add the "Seaweed-" prefix when uploading files using FilerClient.
+ * This causes inconsistency in the key of Extended format of the two file upload methods.
+ *
+ * solution:
+ * When storing Entry, add the "Seaweed-" prefix to the Extended key,
+ * and remove the "Seaweed-" prefix when reading Entry information.
+ * Users will not be aware of the "Seaweed-" prefix when using it,
+ * and the format of the Extended key in the two upload methods will be unified.
+ *
+ * @author stillmoon
+ */
+public class ExtendedFormatUtil {
+
+ public static void addKeyPrefix(FilerProto.Entry.Builder entry) {
+ Map extendedMap = new HashMap<>(entry.getExtendedCount());
+ entry.getExtendedMap().forEach((key, val) -> {
+ extendedMap.put("Seaweed-" + key, val);
+ });
+ entry.clearExtended();
+ entry.putAllExtended(extendedMap);
+ }
+
+ public static void removeKeyPrefix(FilerProto.Entry.Builder entry) {
+ Map extendedMap = new HashMap<>(entry.getExtendedCount());
+ entry.getExtendedMap().forEach((key, val) -> {
+ extendedMap.put(key.replace("Seaweed-", ""), val);
+ });
+ entry.clearExtended();
+ entry.putAllExtended(extendedMap);
+ }
+
+}
diff --git a/other/java/client/src/main/java/seaweedfs/client/FilerClient.java b/other/java/client/src/main/java/seaweedfs/client/FilerClient.java
index 6d9f41d9e..7318ee23e 100644
--- a/other/java/client/src/main/java/seaweedfs/client/FilerClient.java
+++ b/other/java/client/src/main/java/seaweedfs/client/FilerClient.java
@@ -61,6 +61,9 @@ public class FilerClient extends FilerGrpcClient {
}
public static FilerProto.Entry afterEntryDeserialization(FilerProto.Entry entry) {
+ FilerProto.Entry.Builder builder = entry.toBuilder();
+ ExtendedFormatUtil.removeKeyPrefix(builder);
+ entry = builder.build();
if (entry.getChunksList().size() <= 0) {
if (entry.getContent().isEmpty()) {
return entry;
diff --git a/other/java/client/src/main/java/seaweedfs/client/SeaweedWrite.java b/other/java/client/src/main/java/seaweedfs/client/SeaweedWrite.java
index 88c7cefbe..f22834cbb 100644
--- a/other/java/client/src/main/java/seaweedfs/client/SeaweedWrite.java
+++ b/other/java/client/src/main/java/seaweedfs/client/SeaweedWrite.java
@@ -113,6 +113,7 @@ public class SeaweedWrite {
List chunks = FileChunkManifest.maybeManifestize(filerClient, entry.getChunksList(), parentDirectory);
entry.clearChunks();
entry.addAllChunks(chunks);
+ ExtendedFormatUtil.addKeyPrefix(entry);
filerClient.getBlockingStub().createEntry(
FilerProto.CreateEntryRequest.newBuilder()
.setDirectory(parentDirectory)