Add File creates absolute link
Permalink
We're beginning our migration of several sites to our production servers. Upon moving them, we are finding that files linked in the tinyMCE editor using the Add File (from the C5 toolbar above tinyMCE) are linking back to our development servers.
Is this a bug or the only way to make this work with tinyMCE?
Why not make the paths relative?
Is this a bug or the only way to make this work with tinyMCE?
Why not make the paths relative?
Interesting. We've been on 5.4.0.5 for most of the development cycle, though we were on 5.4.0.2 for just a few days and I don't think much content was added on any of the sites in that short span.
I'll have to verify that my controller file is the correct version.
BTW, I think it is adding a relative link, but adding in the DIR_REL as well.
I'll have to verify that my controller file is the correct version.
BTW, I think it is adding a relative link, but adding in the DIR_REL as well.
Ok, it's starting to make sense now. Your point about DIR_REL is well taken. So if the dev site is in a subdirectory within the live site, I could see how the addition of DIR_REL would cause the problem you described.
Actually, now that I look at it again, I was wrong earlier, when I said that the link is getting translated to a {CCM:FID_**} tag. It does work that way for inline files (e.g. images) -- so I'm guessing those didn't give you any trouble -- but for downloaded files, the link just gets stored "as-is" -- That's why the DIR_REL is there.
I don't know why "Add File" links are getting handled differently from inline files. It seems to me that the problem would be solved by storing them as {CCM:FID_**} tags. Maybe Frz or Andrew could explain the reason for this?
Actually, now that I look at it again, I was wrong earlier, when I said that the link is getting translated to a {CCM:FID_**} tag. It does work that way for inline files (e.g. images) -- so I'm guessing those didn't give you any trouble -- but for downloaded files, the link just gets stored "as-is" -- That's why the DIR_REL is there.
I don't know why "Add File" links are getting handled differently from inline files. It seems to me that the problem would be solved by storing them as {CCM:FID_**} tags. Maybe Frz or Andrew could explain the reason for this?
True, inline images and internal page links render fine upon migration.
I wonder what a little tweaking will do....I'll report the results soon.
I wonder what a little tweaking will do....I'll report the results soon.
Well, from what I can tell, the file link is being written in with the editor_init.php file and the controller merely translates the link. I can see why they aren't writing file links in the same way as images because it produces the absolute path to the file, which is bad if you are trying to protect them with advanced permissions.
I'll do a little more tinkering to see if I can come up with solution.
I'll do a little more tinkering to see if I can come up with solution.
If you look in concrete/blocks/content/controller.php, you can see how the link is getting translated to a {CCM:FID_**} tag before saving and translated back to a URL for display in TinyMCE, but a relative URL stays a relative URL.
I'm pretty new to C5... Maybe this code has changed in a recent revision. What version were you running on the dev servers when the files were added?