isURLPrefixExists() is used after url2Stat() function to check if the
given aliased URL corresponds to an existing prefix in the server. However,
url2Stat() is already doing that and returns valid information for
those prefixes.
Removing isURLPrefixExists() all together.
--rewind will go back in time and select specific object versions that are
the latest at the specified time.
--versions will display all the versions
cp will just ignore if the latest version is a delete marker
ls will print delete markers with a (deleted) at the end
Stat() is supposed to return valid information for existing
objects and existing prefixes as well.
The current mechanism issues a listing request and searches
for the object or prefix in the returned list, but this could take
time if there are a lot of entries under a parent prefix.
The new commit changes the internal behavior but not the
functional output. It issues a HEAD request first, if there
is no object then assumes it is a prefix and does listing
in order to find it.
As unix cp command complains when you copy a directory into itself,
(such as `cp -r ~/Desktop/ ~/Desktop/sub/`), mc will follow the
same behavior with this commit.
The main reason is that copy or mirror command can be unpredictable
with the style of copy.
Example:
```
$ mc ls -r myminio/testbucket/
[2018-09-25 19:28:17 CET] 8B dir/object
[2018-09-25 19:28:40 CET] 8B object
$ mc -q cp -r myminio/testbucket/ myminio/testbucket/dir/
`myminio/testbucket/dir/object` -> `myminio/testbucket/dir/dir/object`
`myminio/testbucket/object` -> `myminio/testbucket/dir/object`
```
We can notice that `myminio/testbucket/dir/object` is both source and target
in the copy operation. The last copy operation that will occur will rule the
result of the total copy operation and `myminio/testbucket/dir/dir/object`
will have a different content in each copy operation.
Due to the unpredictability mentionned above, we will disallow copying or
mirroring a folder into itself.
Currently even if the command supports encrypted objects,
the syntax verification would fail on them in certain
cases. Since syntax validation of source/targets doesn't
use the parsed encrypt key pairs. This PR fixes this
behavior.