we're using a custom Amazon S3 ECL Provider. The problem is that there are some Components that have titles longer than 255 character long and it's throwing an exception. The problem is that the file system doesn't support more than 255 characters on the name of the file (Windows 2012).
As a solution I'm trying to convert those titles into something smaller so the filename will be less that 255. I can encode using MD5 the eclUri
to a number calling the ECL Service method CreateOrGetStubUris
and it works. Then I have two problems:
- Where do I store the original name of the file (probably I can save it in the metadata of the stub.
- If I don't create the stub manually calling
CreateOrGetStubUris
and the stub gets created automatically (hitting the methodStubComponentCreated
in the provider) how do I change its title? In that method I can't access the stub as I'm still inside the transaction and the stub doesn't exist yet, right? I need to store the original file name since MD5 is one way and I can't get the original filename from the MD5.
UPDATE
The problem is when selecting a Mountpoint item which has a very long name while saving a component. This is the stacktrace of the exception thrown while saving the component.
Invalid value for property 'Title'. The length of the Title property must be between 1 and 255 characters.
at Tridion.ContentManager.IdentifiableObject.ValidateSystemConstraints()
at Tridion.ContentManager.IdentifiableObject.ValidatePropertyConstraints()
at Tridion.ContentManager.IdentifiableObject.OnSaving(SaveEventArgs eventArgs)
at Tridion.ContentManager.ContentManagement.RepositoryLocalObject.OnSaving(SaveEventArgs eventArgs)
at Tridion.ContentManager.ContentManagement.VersionedItem.OnSaving(SaveEventArgs eventArgs)
at Tridion.ContentManager.ContentManagement.Component.OnSaving(SaveEventArgs eventArgs)
at Tridion.ContentManager.IdentifiableObject.Save(SaveEventArgs eventArgs)
at Tridion.ContentManager.ContentManagement.VersionedItem.Save(Boolean checkInAfterSave)
at Tridion.ExternalContentLibrary.DomainModel.StubItem.CreateNewStubItem(TcmUri stubFolderUri, IEclUri eclUri, MountPoint mountPoint, Boolean checkInAfterSave, XmlElement metadata)
at Tridion.ExternalContentLibrary.DomainModel.StubItem.<>c__DisplayClass1.<CreateOrGetStubId>b__0(TcmUri parentFolderUri)
at Tridion.ExternalContentLibrary.DomainModel.TcmObjectCreator.GetOrCreateItemUri(Session session, TcmUri parentItemUri, String itemName, Func`2 create)
at Tridion.ExternalContentLibrary.DomainModel.TcmObjectCreator.<>c__DisplayClass4.<GetOrCreateItemUri>b__2()
at Tridion.Infrastructure.Caching.Cache`3.GetOrCreateWithBatchRead(TKey key, TValidatorState validateState, Func`1 createNewValues)
at Tridion.ExternalContentLibrary.DomainModel.TcmObjectCreator.GetOrCreateItemUri(TcmUri parentItemUri, IEnumerable`1 path, UserContext userContext, Func`2 create)
at Tridion.ExternalContentLibrary.DomainModel.StubItem.CreateOrGetStubId(IEclUri eclItemUri, MountPoint mountPoint, Boolean checkInAfterSave, XmlElement metadata)
at Tridion.ExternalContentLibrary.DomainModel.UserContext.ExecutePrivileged[T](String userName, Func`1 privilegedCode)
at Tridion.ExternalContentLibrary.DomainModel.MountPoint.<CreateOrGetStubUris>b__5f(<>f__AnonymousType3`2 <>h__TransparentIdentifier59)
at System.Linq.Enumerable.<>c__DisplayClass7_0`3.<CombineSelectors>b__0(TSource x)
at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector, IEqualityComparer`1 comparer)
at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector)
at SyncInvokeCreateOrGetStubUris(Object , Object[] , Object[] )
at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs)
at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage11(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)