Jumoo / uSync.Complete.Issues

Public Issue tracker and roadmap for uSync.Complete
https://jumoo.co.uk/usync/complete/
2 stars 1 forks source link

Could not find a part of the path - Long paths result in missing files #115

Closed robeades closed 3 years ago

robeades commented 3 years ago

When using uSync Publisher to pull content into a blank site I'm getting the following error at the Report stage :

Could not find a part of the path C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\5b5bd1ca\d2e018f4\UmbracoData\uSync\receive\26619c37-aca2-40ef-a992-6969508d810f\media\510l2bhj[some_file_name]

I suspect this might be due to the path exceeding the Windows maximum file path limit as the path in the screenshot is 265 chars. We've a clustered setup so I don't know if this is a contributing factor that causes the files to be stored in the relatively deep Temporary ASP.NET Files folder when the files are being saved.

Umbraco version 8.8.0

Is it possible to specify a custom folder location to allow files to be saved in a shallower folder and consequently allowing longer file names?

image

KevinJump commented 3 years ago

Hi,

yeah it does look like it might be path related ☹️ - but i would just check you are not on a load balanced server/ulr ? if the server is load balanced then requests can switch between servers mid import and then folders that uSync thinks are there are no longer there on the next step.

I would expect us to get a PATH TO LONG exception if it was path based - but that isn't to say this isn't a secondary error.

looking at the options, we don't currently have a way to move this folder out of the Umbraco Temp folder, but we can look at adding it.

there is a windows registry update in windows to remove the long path limitation (see https://docs.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=cmd#enable-long-paths-in-windows-10-version-1607-and-later) maybe that might alivate the issue.

we will also look into impact of adding the \\?\ to the path which could also maybe help here.

robeades commented 3 years ago

Hi,

We are running a load balanced environment but we have it set up so the back office can only be accessed internally on the master server so it shouldn't be an issue of switching servers mid import. I have noticed that media items that fail when syncing to our load balanced environment don't fail when syncing between two non load-balanced environments which would suggest this issue is made worse by the Umbraco.Core.LocalTempStorage : AspNetTemp property we have set for the for load balanced environment.

I did briefly look at enabling long file paths in Windows but was hesitant to go down this route at this point in the project in case it negatively impacted other applications on the server.

For now I've run some queries against the Umbraco database to find those images and files with long file names and we're manually renaming them. There were a fair few documents but fewer images thankfully. Using concise filenames is definitely something we're going to add to our editors manual!

KevinJump commented 3 years ago

For long file names - we are going to add something that essentially saves the media in the sync folder with a guid file name (e.g 3FF578B5-65C2-42CA-BFA7-6223B7540C19.jpg) and then have an additonal file in the folder that tells uSync what the actual name of the guid file is.

on import we will then import the guild file to the proper file location.

this should bypass any issues with media folder names in the sync folders - it won't fix any issues should the target media file path be too long, but that would also be an issue inside umbraco.

will be in next release.

KevinJump commented 3 years ago

Hi,

We have released a new version of uSync.Complete today that should help with this issue. (see https://github.com/Jumoo/uSync.Complete.Issues/releases/tag/8.10.0)

this includes a new SafeMediaName setting, that when set- will rename media files in the temp folder (it gives them a {guid}.extension pattern) - the files are renamed back when imported at the other end, so in theory this gets around the long file names issue.

for v8.10 you need to add the following to the uSync8.config (and restart the site) - to activate this. (and both ends of the process need to be running uSync.Complete v8.10)

<Complete>
   <SafeMediaNames>True</SafeMediaNames>
</Complete>

(docs: https://docs.jumoo.co.uk/uSync/uSync.Complete/config/longfilenames/)