Fix aaPanel Download File Error Due to Wrong Flask Version

1. Cause

Some time ago, I was tossing the Pagoda panel, but the Pagoda cloud control could not be installed, so I forcibly executed btpip install -r requirements.txt. As a result, the Python environment of the Pagoda was blown up, deleted and reinstalled.

However, reinstalling the pagoda Python environment did not solve my problem.

2. Error description

On the file management page of the pagoda panel, click to download the file, and you will be prompted:

Text
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
Something went wrong, an error occurred while the panel was running!
TypeError: send_file() got an unexpected keyword argument 'etag'
REQUEST_DATE: 2023-01-23 21:19:14
  PAN_VERSION: 7.9.7
   OS_VERSION: CentOS 7.9.2009 x86_64(Py3.7.9)
  REMOTE_ADDR: 211.156.80.226
  REQUEST_URI: GET /download?filename=%2Fwww%2Fwwwroot%2Furl%2Fgo_xxWdbE.tar.gz
REQUEST_FORM: {}
   USER_AGENT: Mozilla/5.0 (Linux; Android 9; CMR-W09) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36 EdgA/108.0.1462.54
Traceback (most recent call last):
   File "/www/server/panel/pyenv/lib/python3.7/site-packages/flask/app.py", line 2447, in wsgi_app
     response = self. full_dispatch_request()
   File "/www/server/panel/pyenv/lib/python3.7/site-packages/flask/app.py", line 1952, in full_dispatch_request
     rv = self. handle_user_exception(e)
   File "/www/server/panel/pyenv/lib/python3.7/site-packages/flask/app.py", line 1821, in handle_user_exception
     reraise(exc_type, exc_value, tb)
   File "/www/server/panel/pyenv/lib/python3.7/site-packages/flask/_compat.py", line 39, in reraise
     raise value
   File "/www/server/panel/pyenv/lib/python3.7/site-packages/flask/app.py", line 1950, in full_dispatch_request
     rv = self. dispatch_request()
   File "/www/server/panel/pyenv/lib/python3.7/site-packages/flask/app.py", line 1936, in dispatch_request
     return self.view_functions[rule.endpoint](**req.view_args)
   File "/www/server/panel/BTPanel/__init__.py", line 1025, in download
     max_age=0)
TypeError: send_file() got an unexpected keyword argument 'etag'

As you can see, Flask is mentioned.
Use btpip show flask to check on other servers, the Flask version should be 2.2.2.

3, the solution

execute:

Bash
1
btpip install flask=2.2.2

Restart panel:

Bash
1
bt 1

Solve the problem perfectly.

Fix aaPanel Download File Error Due to Wrong Flask Version

https://blog.tsinbei.com/en/archives/701/

Author
Hsukqi Lee
Posted on

2023-05-18

Edited on

2023-05-18

Licensed under

CC BY-NC-ND 4.0

Comments

Name
Mail
Site
None yet