Проблема с правами на запись для Contribute File Deployer?
Я уже давно пользуюсь инструментом Contribute File Deployer, и он прекрасно работал, пока мы не заменили серверы, на которые он выталкивает файлы. Перенос файлов сам по себе работает нормально, разрешения и все. Но часть основной функции - это сканирование каталога, в который отправляется ваш файл, и, если он не существует, он создает указанный каталог.
На данный момент, это всегда терпит неудачу в этой части инструмента. Формат полного пути загружаемого файла: \\\x.x.x.x\sync$\path/to/folder
(смешанные косые черты всегда работают.)
Это на Windows XP sp3 с ColdFusion 8.
<cftry>
<cfinvoke method="MakeSurePathExists" path="#serverPathToPush##siteRelative#">
<cfcatch type="any">
<cfthrow errorcode="NoLiveServerAccess" message="Can not access or do not have sufficient permissions to write to: #serverPathToPush##siteRelative#">
<cflog application="yes" text="Can not access or do not have sufficient permissions to write to: #serverPathToPush##siteRelative#" file="Filedeployer" />
</cfcatch>
</cftry>
<cffile action="copy" source="#settings.stagingFileSystemPath & siteRelative#" destination="#serverPathToPush##siteRelative#">
<!--- touch the file so it gets the current date, so the browser will pull down the new one when previewed --->
<cffile action="append" file="#serverPathToPush##siteRelative#" output="">
<!--- This function checks if the directory exist of the given file.
If it doesn't, it tries to build path. If it fails, the function throws --->
<cffunction name="MakeSurePathExists">
<cfargument name="path" type="string" required="true">
<cfset createList = ArrayNew(1)>
<cfinvoke method="RemoveLastFileFromPath" path="#path#" returnvariable="parentdir">
<cfloop condition="not DirectoryExists( parentDir ) and Len( parentDir ) gt 0 ">
<cfset temp = ArrayAppend( createList, parentDir ) >
<cfinvoke method="RemoveLastFileFromPath" path="parentdir" returnvariable="parentdir">
</cfloop>
<cfloop from="#ArrayLen( createList )#" to="1" step="-1" index="index">
<cfdirectory action="create" directory="#createList[index]#">
</cfloop>
</cffunction>
<cfscript>
function RemoveLastFileFromPath( path )
{
rpath = Reverse( path ) ;
idx2 = Find( "\", rpath ) ;
idx = Find( "/", rpath ) ;
if( idx2 is not "0" and idx2 lt idx )
idx = idx2 ;
if( idx is not "0" ) {
rpath = Right( rpath, Len(rpath) - idx ) ;
return Reverse( rpath ) ;
}
return "" ;
}
</cfscript>
Дружественная ошибка, которую я получаю:
Невозможно получить доступ или недостаточно прав для записи в: \xxxx \sync$\ path/to/folder/the-file.cfm
Ошибка CFDUMP:
Наиболее вероятной причиной этой ошибки является то, что \ xxxx \ sync $ \ path / to / folder / уже существует в вашей файловой системе. Исключение произошло во время действия cfdirectory ="create".
Мне известно пространство между концом URL ресурса и относительным путем. Опять же, это не было проблемой раньше, и я не уверен, что это сейчас.
1 ответ
Оказывается, в этом случае пространство в URL влияет на push. Я должен был добавить trim() вокруг адреса сервера, и это решило проблему. Однако, почему это только проблема сейчас, а не раньше, я никогда не узнаю.