Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Relative FilePath for AssetFiles is different than for Media_File.DataSourcePath #75

Open
bluemodus-mwills opened this issue Nov 21, 2024 · 4 comments

Comments

@bluemodus-mwills
Copy link

Describe the bug
When importing medial files exported using the Sitecore Migration Tool, I discovered that the folder context is different when importing Media_Files vs AssetFiles.

To Reproduce
Steps to reproduce the behavior:

  1. Import Json serialized Media_File objects using relative FilePaths like this:
    ".\Files\NEWSWIRE\thumbnails24\1NPHW.png"

  2. Import Json serialized AssetFile objects using relative DataSourcePath like this:
    ".\Files\NEWSWIRE\thumbnails24\1NPHW.png"

Result
When importing Media_File objects, the files will be imported using the root of the target CMS project's WebApplicationPhysicalPath.

When importing AssetFiles object, the files will be imported using the environment, current directory.

When importing content using UTM, this causes the asset folder to be created in the same directory as the JSON and medial files exported by the Sitecore migration tool, instead of in the WebApplicationPhyiscalPath/assets folder.

Work around
Update the AssetFile.FilePath of all assets to be an absolute path, so that the current directory can be the same as the WebApplicationPhysicalPath. This prevents the assets from being added to the wrong folder while being imported.

Expected behavior
When assets are imported, files should be saved under the WebApplicationPhyiscalPath not under the Envirobment.CurrentDirectory.

@diger74
Copy link
Collaborator

diger74 commented Nov 21, 2024

@bluemodus-mwills I think this is related to this thing:
#69 (comment)

I also noticed that in your import console app you need to set both paths.

@bluemodus-mwills
Copy link
Author

@diger74 - I have both paths set, but to be clear: When importing media library images using UMT, I was allowed to set the current directory to the location of my import files instead of the WebApplicationPhyiscalPath. That was convenient, because it allowed the FilePath property in my JSON files to use a relative path.

However, when importing asset files, the current directory must be the WebApplicationPhysicalPath. The logic between importing media files and content assets seems to be different.

@tkrch
Copy link
Collaborator

tkrch commented Nov 22, 2024

Hi @bluemodus-mwills, yes this is how content item asset import behaves now. It is unfortunately not related to UMT, but rather to how XbyK API behaves. I will create reproducible sample and forward issue. Lets keep this open to track progress.

@bluemodus-mwills
Copy link
Author

Thank you, @tkrch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants