Closed (fixed)
Project:
Inline
Version:
5.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
21 Nov 2005 at 03:21 UTC
Updated:
23 Feb 2007 at 18:15 UTC
Jump to comment: Most recent file
Using the [inline:#] method for attaching images is very fragile. All it takes is for a replacement image to be uploaded and inline loses its link to the image.
Instead, I propose retaining the # notation simply as a shortcut while authoring a page but always storing tags in nodes with filenames.
Inline would need to intercept the form submission, work out what the filename is for each # and convert the tag to the filename notation.
| Comment | File | Size | Author |
|---|---|---|---|
| #11 | inline.module.numeric.patch | 3.15 KB | sun |
| #9 | inline.numeric_0.patch | 3.83 KB | sun |
| #2 | inline.numeric.patch | 3.53 KB | sun |
Comments
Comment #1
sun+1 sounds well.
With the 4.7 forms api this shouldn't be too hard to implement.
Comment #2
sunHere we go. Attached patch slightly replaces every occurence of # in [inline:#] or [inline:#=title] with the corresponding file name of actual node attachments. This happens everytime a node is being updated oder saved.
Since I'm currently launching a new site I thought it would be much more safe if inline attachments would be stored safe. So I have realized your idea.
Comment #3
Bèr Kessels commentedDid not test the code, but the patch looks solid and clean to me.
Comment #4
sunIs there a demand for a migration script? I'm considering that this patch only works with 4.7 forms API and people would have to migrate their Drupal installation to 4.7, so I would say, new installations of Drupal 4.7 incl. inline module will be safe in the future. However, there are a lot of people who used inline module in previous versions.
With the requirement of Drupal 4.7 in mind I could imagine an additive invocation of the new function to convert any numeric inline tags to named ones while contents are only viewed, not edited.
For already broken attachments there would be no difference. But those working tags would be converted to a safer syntax.
Additionally I want to point out that this patch does not alter inline tags in preview mode - deliberately. While still authoring a node, numeric inline tags are much more usable.
Comment #5
Richard Archer commentedThe upgrade path is actually where I got stuck on this patch.
I think it would be very nice to convert all old-style inline:# tags. But there doesn't seem to be a way for a module to interface with the upgrade system. And there's no easy way for inline to retrieve a list of all inline tags that are being used in a site.
I guess you'd just need to add some code to inline that looked for these old tags and converted them on-the-fly. And if the node is saved, then write out the new format. Which seems to be a fair bit of baggage to be carrying around.
Comment #6
Bèr Kessels commentedAny module can interface with the upgrade system. There is a handbook page about this, one that I cannot find right now :(.
I have used it to change a filter in the past. just do a LOT of node-loads, parse the data and do a node-save. It might timeout, but even that can be acted upon, look at how the revisions upgrade handled that.
Bèr.
Comment #7
sunjust for the record: isn't the upgrade possibitility another issue?
In between I can confirm that the patch works well for creating and updating contents. This fixes at least any content which is edited *now*. Upgrading and migration should be an offshoot of this issue.
Comment #8
sunIf still complaining about the migration issue: Using the upgrade functions for modules I would suggest to rewrite all numeric inline tags by searching and replacing with a regex through the database. So conversion would be done at one time. Any concerns or better suggestions?
Comment #9
sunUpdated patch
Comment #10
sunThis is a bug, not a feature. And this should get into the new DRUPAL-5 branch immediately to kinda 'protect' any new users of inline.
Some thoughts on the need for migration: IIRC, numeric assignments get only broken if a new (upload) attachment is added or an existing (upload) attachment is removed. So regarding migration, the additional solution for this problem should be to transform existing inline tags in front of displaying a node edit form, right?
Comment #11
sunAnd here follows the magic patch! Replaces numeric inline tags with named ones
Comment #12
sunAs mentioned before, this is a serious issue on certain sites.
Committed to HEAD and DRUPAL-5.
Changed title to better suit this issue.
Backport for DRUPAL-4-7 needed.
Comment #13
sunComment #14
(not verified) commented