Path too long Exception
When you have Media files on your Umbraco Cloud project with a file name longer than 80 characters, you will not be able to transfer and/or restore between your Cloud environments.
How does it look?
The exception you will see on content transfer / restore will look something like this:
System.IO.PathTooLongException: The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.
The full stacktrace:
This is a known issue with Microsoft servers, that limits the amounts of characters allowed in a path.
Solution
In order to fix this error, you will need to connect to the Live Environments project's database.
Connect to your Live environments database.
In the database run the following query to find the faulty media files:
Identify the files with a path longer than 80 characters.
Find the files in the Media section in the Umbraco backoffice.
Remove the media files from the backoffice.
Make sure to note down where the media item is being used in the content
Change the names of the media files giving them shorter names.
Re-upload the renamed file to the Media section in the backoffice.
Once re-added in the backoffice, make sure to add the media back in the content where it was used.
Last updated