Skip to content

Commit 05565e5

Browse files
committed
Add methods to generate advisories URLs and update fetch_advisories to use the new API URL
1 parent b25c371 commit 05565e5

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

app/models/package.rb

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -717,8 +717,16 @@ def related_packages
717717
registry.packages.repository_url(repository_url).where.not(id: id)
718718
end
719719

720+
def advisories_url
721+
"https://advisories.ecosyste.ms/advisories?ecosystem=#{ecosystem}&package_name=#{to_param}"
722+
end
723+
724+
def advisories_api_url
725+
"https://advisories.ecosyste.ms/api/v1/advisories?ecosystem=#{ecosystem}&package_name=#{to_param}"
726+
end
727+
720728
def fetch_advisories
721-
ecosystems_api_get("https://advisories.ecosyste.ms/api/v1/advisories?ecosystem=#{ecosystem}&package_name=#{to_param}") || []
729+
ecosystems_api_get(advisories_api_url) || []
722730
rescue
723731
[]
724732
end

0 commit comments

Comments
 (0)