Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions gcp/website/frontend_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,8 @@

@blueprint.route('/linter', strict_slashes=False)
def linter():
if request.host_url == 'osv.dev':
return redirect(request.url.replace('osv.dev', 'test.osv.dev'), code=302)
Comment thread Dismissed
return render_template('linter.html')


Expand Down
15 changes: 14 additions & 1 deletion gcp/website/linter_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

import json
import logging
from flask import Blueprint, abort, jsonify
from flask import Blueprint, abort, jsonify, redirect, request
from google.cloud import storage

blueprint = Blueprint('linter_api', __name__, url_prefix='/linter-findings')
Expand All @@ -25,6 +25,19 @@
LINTER_PREFIX = 'linter-result/'


@blueprint.before_request
def redirect_to_test():
"""Redirect requests from production to test site."""
if request.host == 'osv.dev':
return redirect(request.url.replace('osv.dev', 'test.osv.dev'), code=302)
Comment thread Dismissed

if request.host == 'api.osv.dev':
return redirect(
request.url.replace('api.osv.dev', 'api.test.osv.dev'), code=302)
Comment thread Dismissed

return None


def _get_storage_client():
"""Get storage client."""
return storage.Client()
Expand Down
Loading