Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions core/components/com_courses/models/asset.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,18 @@ public function path($course=0, $withUrl=true)
// Override path for url/link type assets
if (in_array(strtolower($this->get('type')), array('form', 'link', 'url')))
{
$path = $this->get('url');
$path = $this->get('url'); // may be truncated (VARCHAR 255)
$content = $this->get('content'); // contains full URL
// Heuristic: truncated URLs usually hit the column limit
if ($path !== null && strlen($path) >= 250)
{
// Try to recover the full URL from content
if (preg_match('~https?://[^\s"\')<>]+~i', $content, $m))
{
$path = $m[0];
}
}
}

return $path;
}

Expand Down