Bug reports Found a bug? Post it here please.
Version 4.x > Bug reports > Linked attachments break when containing page moves or is renamed View modes: 
User avatar
Member
Member
Josh Larios - 9/14/2009 3:06:38 PM
   
Linked attachments break when containing page moves or is renamed
On our site, we're not using permanent URLs, and we are using extensionless URLs.

In general, when we create a page with images, the images are saved as attachments to the document on which they'll be displayed.

If I create a page (say, /catalog/test-1), attach an image (logo.gif) and include that image on the page, the InsertImageOrMedia selector inserts the URL as "/getattachment/catalog/test-1/logo.gif".

If I then move that page to another part of the site, say to /careers/test-1, the image no longer displays, even if I have "Remember original URLs when moving documents" enabled. The old URL continues to work for the page itself, but the attachments no longer work. That is: /careers/test-1 and /catalog/test-1 are both still valid URLs, but /getattachment/catalog/test-1/logo.gif (what the media selector inserted) is no longer valid, while /getattachment/careers/test-1/logo.gif is.

This also happens if I change the document alias using the Properties -> URLs tab.

I don't know if the best way to fix this would be to scan the document contents for references to "getattachment" and rewrite them when the document's properties change, or if the attached objects should have aliases added, or what. But as it is, while attachments are a very cool addition to Kentico, they don't work for us in a critical way.

Maybe if there were an inline control that replaces a guid with the current document alias, the InsertImageOrMedia selector could insert that, so that the links would be resolved at runtime, rather than at the time of insertion. I dunno.

User avatar
Kentico Developer
Kentico Developer
kentico_ondrejv - 9/18/2009 8:42:01 AM
   
RE:Linked attachments break when containing page moves or is renamed
Hello,

Actually this is by design behavior. 'Remember original URLs when moving documents' serves only for documents. Anyway you can use 'Use permanent URLs' for that purpose.

Thanks for understanding.

Best Regards
Ondrej Vasil

User avatar
Member
Member
Josh Larios - 9/18/2009 11:03:16 AM
   
RE:Linked attachments break when containing page moves or is renamed
So let's say I have a site like this:

Root
\_ Page 1
|_ Page 2
|_attachment 1
|_attachment 2
|_Page 3
|_Page 4

(Page 1 is under the root, Page 2 is under Page 1, attachments 1 and 2 are attached to Page 2, and Pages 3 and 4 are under Page 2.) And I have "Use permanent URLs" disabled and "remember original URLs" enabled.

The desired behavior when I move Page 2 up to be directly under the root is that Pages 3 and 4 should continue to work, but attachments 1 and 2 should break? If attachments 1 and 2 had been Files under Page 2 rather than Attachments, that wouldn't be the case.

I'll accept that this was a design decision; I just think it's a very strange one.

User avatar
Kentico Developer
Kentico Developer
kentico_ondrejv - 9/29/2009 6:47:28 AM
   
RE:Linked attachments break when containing page moves or is renamed
Hello,

I understand the difficulties which could come up with this behavior. I'm giving this as a requirement for further versions. Our product manager will consider that.

Best Regards
Ondrej Vasil