From 9dd54ffb1c04dd7ba216a4420efce75fb9f603e7 Mon Sep 17 00:00:00 2001
From: ThibG <thib@sitedethib.com>
Date: Mon, 25 Feb 2019 15:54:17 +0100
Subject: [PATCH] Avoid redundant HTTP request on some error cases (#10115)

---
 app/helpers/jsonld_helper.rb | 1 +
 1 file changed, 1 insertion(+)

diff --git a/app/helpers/jsonld_helper.rb b/app/helpers/jsonld_helper.rb
index 5323972723..59e4ae6851 100644
--- a/app/helpers/jsonld_helper.rb
+++ b/app/helpers/jsonld_helper.rb
@@ -68,6 +68,7 @@ module JsonLdHelper
       return body_to_json(response.body_with_limit) if response.code == 200
     end
     # If request failed, retry without doing it on behalf of a user
+    return if on_behalf_of.nil?
     build_request(uri).perform do |response|
       response.code == 200 ? body_to_json(response.body_with_limit) : nil
     end