Unable to preview office files in encrypted libraries

Recently, I’ve been unable to preview office files (like Microsoft Word documents) in the browser. I get an error that the file can’t be previewed because it’s in an encrypted library—although I’m able to preview the file in the iPhone app. I wrote a script that edits the file.py file and bypasses the error, and also gets rid of another error concerning seafile-ui.map. I’m not sure what the purpose of this code is, but this eliminates the errors. You have to run the script every time you update seafile.

#!/bin/bash
read -p "what is the base directory to your seafile server?" basedir
sudo cp "$basedir/seafile-server-latest/seahub/seahub/views/file.py" "$basedir/seafile-server-latest/seahub/seahub/views/file.py.bak"
cat "$basedir/seafile-server-latest/seahub/seahub/views/file.py" | sed -z 's/\n/_____newline_____/g' | sed -E 's/_____newline_____( *if repo.encrypted:)_____newline_____( *error_msg = _\('"'"'The library is encrypted, can not open file online\.'"'"'\))_____newline_____( *return False, error_msg)/\n\#\1\n\#\2\n\#\3/g;s/_____newline_____( *if repo.encrypted:)_____newline_____( *return_dict\['"'"'err'"'"'\] = _\('"'"'The library is encrypted, can not open file online\.'"'"'\))_____newline_____( *return render\(request, template, return_dict\))/\n\#\1\n\#\2\n\#\3/g;s/_____newline_____/\n/g' > /tmp/f
sudo mv /tmp/f "$basedir/seafile-server-latest/seahub/seahub/views/file.py"
sudo chown seafile:seafile "$basedir/seafile-server-latest/seahub/seahub/views/file.py" "$basedir/seafile-server-latest/seahub/seahub/views/file.py.bak"
sudo sed -Ei 's/(\/\*)#( sourceMappingURL=seafile-ui\.map\*\/)/\1!\2/' "$basedir/seafile-server-latest/seahub/media/css/seafile-ui.css”