You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tika.apache.org by ti...@apache.org on 2025/10/31 18:30:24 UTC
(tika) branch main updated: TIKA-4538: AZBlobFetcher always throws FileAlreadyExistsException (#2383)
This is an automated email from the ASF dual-hosted git repository.
tilman pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tika.git
The following commit(s) were added to refs/heads/main by this push:
new 3c7660ff0 TIKA-4538: AZBlobFetcher always throws FileAlreadyExistsException (#2383)
3c7660ff0 is described below
commit 3c7660ff0e81f6db4bfe2696ff12b585f76779cb
Author: Matthew Dutton <Ma...@gmail.com>
AuthorDate: Fri Oct 31 14:30:19 2025 -0400
TIKA-4538: AZBlobFetcher always throws FileAlreadyExistsException (#2383)
REF: https://issues.apache.org/jira/browse/TIKA-4538
When hosting Tika on Windows, calling the /tika/* endpoints with
enableUnsecureFeatures=true and using AZBlobFetcher, the AZBlobFetcher throws a
FileAlreadyExistsException exception.
The AZBlobFetcher uses TemporaryResources.createTempFile() which uses
java.nio.file.Files.createTempFile to create the temp file. This function does
not just generate a new, unique name but also creates the actual file.
REF: https://docs.oracle.com/javase/8/docs/api/java/nio/file/Files.html#createTempFile-java.nio.file.Path-java.lang.String-java.lang.String-java.nio.file.attribute.FileAttribute...-
When AZBlobFetcher calls BlobClient.downloadToFile(string), it throws an
exception for the existing file.
This changes to use BlobClient.downloadToFile(string,bool overwrite=true) to
account for the existing file.
REF: https://javadoc.io/static/com.azure/azure-storage-blob/12.10.1/com/azure/storage/blob/specialized/BlobClientBase.html#downloadToFile-java.lang.String-
---
.../main/java/org/apache/tika/pipes/fetcher/azblob/AZBlobFetcher.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tika-pipes/tika-fetchers/tika-fetcher-az-blob/src/main/java/org/apache/tika/pipes/fetcher/azblob/AZBlobFetcher.java b/tika-pipes/tika-fetchers/tika-fetcher-az-blob/src/main/java/org/apache/tika/pipes/fetcher/azblob/AZBlobFetcher.java
index 62f082b7f..663327b80 100644
--- a/tika-pipes/tika-fetchers/tika-fetcher-az-blob/src/main/java/org/apache/tika/pipes/fetcher/azblob/AZBlobFetcher.java
+++ b/tika-pipes/tika-fetchers/tika-fetcher-az-blob/src/main/java/org/apache/tika/pipes/fetcher/azblob/AZBlobFetcher.java
@@ -103,7 +103,7 @@ public class AZBlobFetcher extends AbstractFetcher implements Initializable {
long start = System.currentTimeMillis();
TemporaryResources tmpResources = new TemporaryResources();
Path tmp = tmpResources.createTempFile();
- blobClient.downloadToFile(tmp.toRealPath().toString());
+ blobClient.downloadToFile(tmp.toRealPath().toString(), true);
TikaInputStream tis = TikaInputStream.get(tmp, metadata, tmpResources);
long elapsed = System.currentTimeMillis() - start;
LOGGER.debug("took {} ms to copy to local tmp file", elapsed);