s1monw commented on a change in pull request #716: LUCENE-8853: Try parsing
original file extension from tmp file
URL: https://github.com/apache/lucene-solr/pull/716#discussion_r293371952
##########
File path:
lucene/core/src/java/org/apache/lucene/store/FileSwitchDirectory.java
##########
@@ -141,7 +147,14 @@ public static String getExtension(String name) {
if (i == -1) {
return "";
}
- return name.substring(i+1, name.length());
+ String ext = name.substring(i + 1);
+ if (ext.equals("tmp")) {
+ Matcher matcher = EXT_PATTERN.matcher(name);
+ if (matcher.find()) {
+ return matcher.group(1);
+ }
Review comment:
that's difficult since it's ok to create a tmp file with a prefix of "foo"
and a suffix of "bar" that will result in no match. I think we can only do the
best effort on the rename end. I pushed a new commit to make the heuristic
better. I thin that's all we can do.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]