Skip to content

Commit f9988a4

Browse files
kaklikclaude
andcommitted
Fix permalink to redirect instead of duplicating content (#23)
/PermaLink/<module> rendered the module detail page in place, giving the same content two URLs, and threw an unhandled IndexError for a missing/empty module name. It now redirects to /module/<name>/, or to the module list when the module doesn't exist, matching the older MIHO implementation's fallback. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
1 parent 838634c commit f9988a4

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

src/MLABweb/handlers/admin.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,10 @@ def assembly_gh_link(document):
117117
class permalink(BaseHandler):
118118
#@asynchronous
119119
def get(self, module = None):
120-
print(module)
121-
module_data = self.db_web.Modules.find({"_id": module})[0]
122-
documents = glob2.glob(tornado.options.options.mlab_repos+module_data['root']+"//**/*.pdf")
123-
images = glob.glob(tornado.options.options.mlab_repos+module_data['root']+"doc/img/*")
124-
self.render("modules.detail.hbs", module=module, module_data=module_data, images = images, documents=documents, assembly_gh_link = assembly_gh_link)
120+
if not module or not self.db_web.Modules.find({"_id": module}).count():
121+
self.redirect("/modules")
122+
return
123+
self.redirect("/module/{}/".format(module))
125124

126125
class about(BaseHandler):
127126
def get(self):

0 commit comments

Comments
 (0)