jprante / elasticsearch-knapsack

Knapsack plugin is an import/export tool for Elasticsearch
Apache License 2.0
472 stars 77 forks source link

Import target parameter fails when a file extension is provided #17

Closed btiernay closed 10 years ago

btiernay commented 11 years ago

When one specifies target when importing the plugin will fail if a file extension is provided

Specifying target=/path/to/archive.tar.gz produces

SEVERE: [node-test-1379778841182] check existence or access rights: /path/to/archive.tar.gz.tar.gz
java.io.FileNotFoundException: check existence or access rights: /path/to/archive.tar.gz.tar.gz
    at org.xbib.io.commons.TarSession.open(TarSession.java:65)
    at org.xbib.elasticsearch.action.RestImportAction.handleRequest(RestImportAction.java:99)

It looks as though it tries to append the file extension after determining the scheme.

btiernay commented 11 years ago

Looks like the extension needs to be removed prior to creating the URI in RestImportAction:

factory.getConnection(URI.create(scheme + ":" + target))

Since TarSession performs the following:

if (scheme.startsWith("targz")) {
   String s = part + ".tar.gz";
jprante commented 11 years ago

Thanks. The connection factory will be smarter in the next release.

jprante commented 10 years ago

This issue is fixed in the latest release.