Skip to content

feat: update file download methods to accept token as a parameter #23

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 3, 2025
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
20 changes: 6 additions & 14 deletions src/spaceone/file_manager/interface/rest/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,10 @@ async def upload_public_file(self, request: Request, file: UploadFile = File(...

@router.get("/public/{file_id}")
@exception_handler
async def download_public_file(self, request: Request, file_id: str):
async def download_public_file(self, request: Request, file_id: str, token:str):

# params, metdata = self.parse_request(request, self.token.credentials, "file", "get" )
# file_svc = FileService(metdata)

metadata = {
"token": self.token.credentials,
"token": token,
}
params = {
"file_id": file_id,
Expand Down Expand Up @@ -124,12 +121,10 @@ async def upload_domain_file(self, request: Request, file: UploadFile = File(...

@router.get("/domain/{file_id}")
@exception_handler
async def download_domain_file(self, file_id:str, request: Request) -> StreamingResponse:
async def download_domain_file(self, file_id:str, token:str, request: Request) -> StreamingResponse:

# params, metdata = self.parse_request(request, self.token.credentials, "file", "get" )

metadata = {
"token": self.token.credentials,
"token": token,
}
params = {
"file_id": file_id,
Expand Down Expand Up @@ -192,13 +187,10 @@ async def upload_workspace_file(self, request: Request, file: UploadFile = File(

@router.get("/workspace/{file_id}")
@exception_handler
async def download_workspace_file(self, file_id:str, request: Request):

# params, metdata = self.parse_request(request, self.token.credentials, "file", "get" )
# file_svc = FileService(metdata)
async def download_workspace_file(self, file_id:str, token:str, request: Request):

metadata = {
"token": self.token.credentials,
"token": token,
}
params = {
"file_id": file_id,
Expand Down
7 changes: 2 additions & 5 deletions src/spaceone/file_manager/interface/rest/user_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,10 @@ async def upload_user_file(self, request: Request, file: UploadFile = File(...))

@router.get("/user/{file_id}")
@exception_handler
async def download_user_file(self, file_id:str, request: Request):
async def download_user_file(self, file_id:str, token:str, request: Request):

# params, metdata = self.parse_request(request, self.token.credentials, "userfile", "add" )
# userfile_svc = UserFileService(metdata)

metadata = {
"token": self.token.credentials,
"token": token,
}
params = {
"file_id": file_id,
Expand Down
Loading