This commit is contained in:
Your Name 2022-05-13 22:26:19 -04:00
parent 902dc3d9eb
commit d97c9704d0

View file

@ -396,8 +396,11 @@ def jump_or_scrape(request, url):
return render(request, 'common/error.html', {'msg': _("链接无效,查询失败")})
else:
try:
# raise ObjectDoesNotExist
effective_url = scraper.get_effective_url(url)
except ValueError:
return render(request, 'common/error.html', {'msg': _("链接无效,查询失败")})
try:
# raise ObjectDoesNotExist
entity = scraper.data_class.objects.get(source_url=effective_url)
# if exists then jump to detail page
return redirect(entity)