detail.html updated with proper folder validation