Skip to content
Snippets Groups Projects
Commit 71331aab authored by Wei Liu's avatar Wei Liu
Browse files

Fixed mismatched collection types

parent 3c114e22
Branches
Tags
No related merge requests found
......@@ -20,7 +20,7 @@ public class DirectoryUploadJob extends UploadJob {
CollectionPath dstCollectionPath, boolean isParentCollection) {
super(isParentCollection
? new CollectionPath(PathUtils.joinSystemIndependent(dstCollectionPath.path(),
srcDir.normalize().toAbsolutePath().toFile().getName()), null)
srcDir.normalize().toAbsolutePath().toFile().getName()), dstCollectionPath.type())
: dstCollectionPath);
_srcDir = srcDir.normalize().toAbsolutePath();
if (includes != null && !includes.isEmpty()) {
......
......@@ -98,8 +98,16 @@ public class CollectionPath {
public synchronized boolean exists(MFSession session, boolean refresh) throws Throwable {
if (_exists == null || refresh) {
_exists = AssetUtils.collectionAssetExists(_path, session)
|| AssetNamespaceUtils.assetNamespaceExists(session, _path);
if (_type != null) {
if (_type == CollectionType.COLLECTION_ASSET) {
_exists = AssetUtils.collectionAssetExists(_path, session);
} else {
_exists = AssetNamespaceUtils.assetNamespaceExists(session, _path);
}
} else {
_exists = AssetUtils.collectionAssetExists(_path, session)
|| AssetNamespaceUtils.assetNamespaceExists(session, _path);
}
}
return _exists;
}
......
......@@ -23,10 +23,10 @@ public class CollectionUtils {
}
CollectionType type = CollectionType.collectionTypeFor(path, session);
if (type == CollectionType.COLLECTION_ASSET) {
return AssetUtils.createCollectionAsset(session, path, createParents, ignoreIfExists);
} else if (type == CollectionType.ASSET_NAMESPACE) {
AssetNamespaceUtils.createAssetNamespace(session, path, createParents, ignoreIfExists);
return AssetNamespaceUtils.getAssetNamespaceId(session, path);
} else if (type == CollectionType.ASSET_NAMESPACE) {
return AssetUtils.createCollectionAsset(session, path, createParents, ignoreIfExists);
} else {
throw new Exception("Unsupported conllection type: " + type);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment