Skip to content

Commit

Permalink
perf: 优化单文件自动转编码功能
Browse files Browse the repository at this point in the history
  • Loading branch information
O-Jiangweidong committed Sep 5, 2024
1 parent 027637e commit 94ef440
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Dockerfile-ce
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ ARG TOOLS=" \
xz-utils \
wget"

ARG APT_MIRROR=http://mirrors.ustc.edu.cn
#ARG APT_MIRROR=http://mirrors.ustc.edu.cn
ARG APT_MIRROR=http://mirrors.tuna.tsinghua.edu.cn
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked,id=core-apt \
--mount=type=cache,target=/var/lib/apt,sharing=locked,id=core-apt \
sed -i "s@http://.*.debian.org@${APT_MIRROR}@g" /etc/apt/sources.list \
Expand Down Expand Up @@ -96,7 +97,8 @@ ARG TOOLS=" \
vim \
wget"

ARG APT_MIRROR=http://mirrors.ustc.edu.cn
#ARG APT_MIRROR=http://mirrors.ustc.edu.cn
ARG APT_MIRROR=http://mirrors.tuna.tsinghua.edu.cn
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked,id=core-apt \
--mount=type=cache,target=/var/lib/apt,sharing=locked,id=core-apt \
sed -i "s@http://.*.debian.org@${APT_MIRROR}@g" /etc/apt/sources.list \
Expand Down
4 changes: 4 additions & 0 deletions apps/behemoth/api/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,10 @@ def upload_command_file(self, request, *args, **kwargs):
_('The {} cannot be empty').format('zip_entry_file')
)
file = self._handle_zip_file(file, entry)
else:
file.seek(0)
content = self.remove_bom(file.read())
file = ContentFile(content, name=self.get_filename(file.name))

name, ext = os.path.splitext(file.name)
file_name = f'{name}-{local_now_display("%Y_%m_%d_%H_%M_%S")}{ext}'
Expand Down

0 comments on commit 94ef440

Please sign in to comment.