Skip to content

FIX: Broken file link tracking (fixes #996) #998

merged 1 commit into from Apr 28, 2014

3 participants

SilverStripe Ltd. member

List of changes:

  • Switched SiteTree linking to use SiteTree::get()->byID($id) instead of DataObject::get_by_id()
  • Removed the attempted ‘ss-broken’ class removal - this never worked: the class attribute was changed but this modified field data was never added to the record.
  • Fixed link tracking for files to be parsed from shortcodes instead of scanning for the presence of ASSETS_DIR in the href
  • Allowed spaces in the link shortcodes for legacy CMS support

If it’d be preferred, I can re-add the old file link tracking (that searches the href for ASSETS_DIR) in case any legacy CMS content is relying on that.

SilverStripe Ltd. member

Removed SiteTreeBrokenLinksTest::testBrokenAssetLinks() as this is now covered in SiteTreeHTMLEditorFieldTest


Following on from your comments from #954, can you change the regex on line 41 to accept either a comma or whitespace between the sitetree_link and id fields in the shortcode? A previous version of the CMS set the shortcode with a space instead of a comma; adding for backwards compatibility. eg:

SilverStripe Ltd. member

Pull request and tests updated to accept spaces in the shortcode :)

@tractorcow tractorcow merged commit 341eeb7 into silverstripe:3.1 Apr 28, 2014
@kinglozzer kinglozzer deleted the kinglozzer:pulls/sitetree-file-linktracking branch Apr 28, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.