Upplication / Amazon-S3-FileSystem-NIO2

An S3 File System Provider for Java 7
MIT License
122 stars 67 forks source link

S3Path::toUri forgets to encode relative paths #99

Closed sbeimin closed 6 years ago

sbeimin commented 6 years ago

If a path is relative and contains spaces the toUri method throws an exception.

labkey-dave commented 6 years ago

I very much hope to see this fix accepted. I've put in a couple of workaround in my code that uses this package, but hard to always avoid since it's called within other s3fs functions. Here's an example call stack copying from a stream to a file: java.lang.IllegalArgumentException: Illegal character in path at index 14: SpecimenDetail (3).xls at java.net.URI.create(URI.java:852) at com.upplication.s3fs.S3Path.toUri(S3Path.java:468) at com.upplication.s3fs.S3Path.toString(S3Path.java:555) at com.upplication.s3fs.S3SeekableByteChannel.sync(S3SeekableByteChannel.java:107) at com.upplication.s3fs.S3SeekableByteChannel.close(S3SeekableByteChannel.java:90) at java.nio.channels.Channels$1.close(Channels.java:178) at java.nio.file.Files.copy(Files.java:3028)

Please fix in the next release!!! Thanks.

fprochazka commented 6 years ago

Relevant: #100, #92, #93

jarnaiz commented 6 years ago

Thanks all for the feedback and sorry for the delay... new version 2.2.2 released to maven central

fprochazka commented 6 years ago

@jarnaiz thank you!