Fix handling of errors for downloading Overdrive Read format
[sitka/overdrive-evergreen-opac.git] / src / od_action.coffee
index 8b330a1..a524544 100644 (file)
@@ -451,10 +451,9 @@ define [
                                                        type: type
                                } = format
 
-                               x = encodeURIComponent window.location.href
                                href = href
-                                       .replace /\{errorpageurl\}/, x
-                                       .replace /\{odreadauthurl\}/, x
+                                       .replace /\{errorpageurl\}/, encodeURIComponent window.location.href
+                                       .replace /\{odreadauthurl\}/, encodeURIComponent "#{window.location.href}&reserveid=[RESERVE_ID]&read_error=[READ_ERROR]"
 
                                action = format.linkTemplates.downloadLink
                                $.extend action, _of: $tr, _name: n, _id: id, href: href