Skip to content

Commit

Permalink
Nevermind, redirect is not enough
Browse files Browse the repository at this point in the history
  • Loading branch information
Willy-JL committed Nov 2, 2024
1 parent 4f4f53f commit c2b817e
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions indexer/src/directories.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,24 +125,24 @@ async def reindex_request():
logging.exception(e)
return JSONResponse("Reindexing is failed!", status_code=500)

if isinstance(index, RepositoryIndex):
# if isinstance(index, RepositoryIndex):

@router.get(prefix + "/{branch}")
async def repository_branch_request(branch):
"""
A method for retrieving the list of files from a specific branch
Made for support of `ufbt update --index-url {base_url}/firmware --branch {branch}`
Args:
branch: Branch name
# @router.get(prefix + "/{branch}")
# async def repository_branch_request(branch):
# """
# A method for retrieving the list of files from a specific branch
# Made for support of `ufbt update --index-url {base_url}/firmware --branch {branch}`
# Args:
# branch: Branch name

Returns:
Redirect to directory listing
"""
if len(index.index["channels"]) == 0:
return JSONResponse("No channels found!", status_code=404)
return RedirectResponse(
os.path.join(settings.base_url + prefix, branch), status_code=303
)
# Returns:
# Redirect to directory listing
# """
# if len(index.index["channels"]) == 0:
# return JSONResponse("No channels found!", status_code=404)
# return RedirectResponse(
# os.path.join(settings.base_url + prefix, branch), status_code=303
# )


for directory, index in indexes.items():
Expand Down

0 comments on commit c2b817e

Please sign in to comment.