myexperiment-hackers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[myexperiment-hackers] [3377] branches/wf4ever: changed "pack not found"


From: noreply
Subject: [myexperiment-hackers] [3377] branches/wf4ever: changed "pack not found" error to an HTTP 404 response
Date: Wed, 30 Jan 2013 05:48:21 +0000 (UTC)

Revision
3377
Author
dgc
Date
2013-01-30 05:48:20 +0000 (Wed, 30 Jan 2013)

Log Message

changed "pack not found" error to an HTTP 404 response

Modified Paths

Diff

Modified: branches/wf4ever/app/controllers/packs_controller.rb (3376 => 3377)


--- branches/wf4ever/app/controllers/packs_controller.rb	2013-01-29 18:41:40 UTC (rev 3376)
+++ branches/wf4ever/app/controllers/packs_controller.rb	2013-01-30 05:48:20 UTC (rev 3377)
@@ -592,25 +592,21 @@
       "update_item"        => "edit"
     }
 
-    begin
-      pack = Pack.find(params[:id])
+    pack = Pack.find(params[:id])
+    
+    if Authorization.check(action_permissions[action_name], pack, current_user)
+      @pack = pack
       
-      if Authorization.check(action_permissions[action_name], pack, current_user)
-        @pack = pack
-        
-        @authorised_to_edit = logged_in? && Authorization.check("edit", @pack, current_user)
-        @authorised_to_download = Authorization.check("download", @pack, current_user)
-        
-        @pack_entry_url = url_for : false,
-                            :host => base_host,
-                            :id => @pack.id
-                            
-        @base_host = base_host
-      else
-        error("You are not authorised to perform this action", "is not authorized")
-      end
-    rescue ActiveRecord::RecordNotFound
-      error("Pack not found", "is invalid")
+      @authorised_to_edit = logged_in? && Authorization.check("edit", @pack, current_user)
+      @authorised_to_download = Authorization.check("download", @pack, current_user)
+      
+      @pack_entry_url = url_for : false,
+                          :host => base_host,
+                          :id => @pack.id
+                          
+      @base_host = base_host
+    else
+      error("You are not authorised to perform this action", "is not authorized")
     end
   end
   

Modified: branches/wf4ever/public/404.html (3376 => 3377)


--- branches/wf4ever/public/404.html	2013-01-29 18:41:40 UTC (rev 3376)
+++ branches/wf4ever/public/404.html	2013-01-30 05:48:20 UTC (rev 3377)
@@ -16,7 +16,7 @@
 			border-right-color: #999;
 			border-bottom-color: #999;
 		}
-		h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
+		h1 { font-size: 100%; line-height: 1.5em; }
 	</style>
 </head>
 
@@ -27,4 +27,4 @@
     <p>You may have mistyped the address or the page may have moved.</p>
   </div>
 </body>
-</html>
\ No newline at end of file
+</html>

reply via email to

[Prev in Thread] Current Thread [Next in Thread]