Skip to content

Commit 17d62b1

Browse files
committed
Fixed issue of app links breaking when the app name has uppercase letters
1 parent 7f3588c commit 17d62b1

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

app.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from flask import Flask, render_template, abort, jsonify
1+
from flask import Flask, render_template, abort, jsonify, redirect
22
from jinja2 import Markup
33
from db import App
44
import web
@@ -29,6 +29,8 @@ def app_page(name):
2929
app = App.find(name)
3030
if not app:
3131
abort(404)
32+
if app.name != name:
33+
return redirect(f"/{app.name}")
3234
return render_template("app.html", app=app, tasks=TASKS)
3335

3436
@app.route("/<name>/deploy", methods=["POST"])

db.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ def find_all(cls):
2626

2727
@classmethod
2828
def find(cls, name):
29-
row = db.where("app", name=name).first()
29+
row = db.query("SELECT * FROM app WHERE lower(name)=lower($name)",
30+
vars={"name": name}).first()
3031
if row:
3132
return cls(row)
3233

templates/app.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ <h1 class="mb-0">{{app.name}}</h1>
3434
<a href="https://{{ app.name }}.rajdhani.pipal.in" class="text-decoration-none" target="_blank">
3535
Visit website
3636
</a>
37+
| <a href="https://github.com/{{app.name}}/rajdhani">Github</a>
3738
</div>
3839
<div>{{app.score}} tasks completed | Current Task: {{ app.current_task }} | Last updated {{datestr(app.last_updated) }}</div>
3940
</div>

0 commit comments

Comments
 (0)