Skip to content

Commit

Permalink
Update Package.php
Browse files Browse the repository at this point in the history
  • Loading branch information
bobimicroweber committed Jan 15, 2024
1 parent 93e4fd1 commit e0d3045
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions app/Models/Package.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,18 @@ public function screenshot()

public function readme()
{
$readmeLink = str_replace('https://example.com/', config('app.url'), $this->readme);

// Fix readme img host links
$content = @file_get_contents($readmeLink);
$content = str_ireplace('https://example.com/', config('app.url'), $content);

return $content;
try {
$readmeLink = str_replace('https://example.com/', config('app.url'), $this->readme);
if (!empty($readmeLink)) {
// Fix readme img host links
$content = @file_get_contents($readmeLink);
$content = str_ireplace('https://example.com/', config('app.url'), $content);

return $content;
}
} catch (\Exception $e) {
return false;
}
}

public function displayName()
Expand Down

0 comments on commit e0d3045

Please sign in to comment.