Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public CopyFromLocalOperation(
this.callbacks = callbacks;
this.deleteSource = deleteSource;
this.overwrite = overwrite;
this.source = source;
this.source = source.toUri().getScheme() == null ? new Path("file://", source) : source;
this.destination = destination;

// Capacity of 1 is a safe default for now since transfer manager can also
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package org.apache.hadoop.fs.s3a;

import java.io.File;
import java.io.IOException;
import java.util.Arrays;
import java.util.Collection;

Expand Down Expand Up @@ -107,4 +108,15 @@ public void testOnlyFromLocal() throws Throwable {
intercept(IllegalArgumentException.class,
() -> getFileSystem().copyFromLocalFile(true, true, dest, dest));
}

@Test
public void testCopyFromLocalWithNoFileScheme() throws IOException {
describe("Copying from local file with no file scheme to remote s3 destination");
File source = createTempFile("tempData");
Path dest = path(getMethodName());

Path sourcePathWithOutScheme = new Path(source.toURI().getPath());
assertNull(sourcePathWithOutScheme.toUri().getScheme());
getFileSystem().copyFromLocalFile(true, true, sourcePathWithOutScheme, dest);
}
}
Loading