fix: cjk chars in filename

This commit is contained in:
Baoshuo Ren 2023-02-06 18:29:52 +08:00
parent 4140e2f4f0
commit 3b109b96b2
Signed by: baoshuo
GPG Key ID: 00CB9680AB29F51A
3 changed files with 5 additions and 3 deletions

View File

@ -6,7 +6,7 @@ ENV USE_MIRROR $USE_MIRROR
SHELL ["/bin/bash", "-c"] SHELL ["/bin/bash", "-c"]
ENV DEBIAN_FRONTEND=noninteractive ENV DEBIAN_FRONTEND=noninteractive
ENV PKGS="php7.4 php7.4-yaml php7.4-xml php7.4-dev php7.4-zip php7.4-mysql php7.4-mbstring php7.4-gd php7.4-curl php7.4-imagick libseccomp-dev git vim ntp zip unzip curl wget apache2 libapache2-mod-xsendfile php-pear mysql-client build-essential fp-compiler re2c libseccomp-dev libyaml-dev python2.7 python3.10 python3-requests openjdk-8-jdk openjdk-11-jdk openjdk-17-jdk" ENV PKGS="php7.4 php7.4-yaml php7.4-xml php7.4-dev php7.4-zip php7.4-mysql php7.4-mbstring php7.4-gd php7.4-curl php7.4-imagick libseccomp-dev git vim ntp zip unzip curl wget apache2 libapache2-mod-xsendfile php-pear mysql-client build-essential fp-compiler re2c libseccomp-dev libyaml-dev python2.7 python3.10 python3-requests openjdk-8-jdk openjdk-11-jdk openjdk-17-jdk language-pack-zh*"
RUN if [[ "$USE_MIRROR" == "1" ]]; then\ RUN if [[ "$USE_MIRROR" == "1" ]]; then\
sed -i "s@http://.*archive.ubuntu.com@https://mirrors.aliyun.com@g" /etc/apt/sources.list &&\ sed -i "s@http://.*archive.ubuntu.com@https://mirrors.aliyun.com@g" /etc/apt/sources.list &&\
sed -i "s@http://.*security.ubuntu.com@https://mirrors.aliyun.com@g" /etc/apt/sources.list ;\ sed -i "s@http://.*security.ubuntu.com@https://mirrors.aliyun.com@g" /etc/apt/sources.list ;\

View File

@ -37,10 +37,10 @@ define('FM_ROOT_URL', UOJProblem::cur()->getResourcesBaseUri());
$sub_path = UOJRequest::get('sub_path', 'is_string', ''); $sub_path = UOJRequest::get('sub_path', 'is_string', '');
if ($sub_path) { if ($sub_path) {
$filepath = realpath(UOJProblem::cur()->getResourcesPath($sub_path)); $filepath = realpath(UOJProblem::cur()->getResourcesPath(rawurldecode($sub_path)));
$realbasepath = realpath(UOJProblem::cur()->getResourcesPath()); $realbasepath = realpath(UOJProblem::cur()->getResourcesPath());
if (!str_starts_with($filepath, $realbasepath)) { if (!strStartWith($filepath, $realbasepath)) {
UOJResponse::page406(); UOJResponse::page406();
} }

View File

@ -1,5 +1,7 @@
<?php <?php
setlocale(LC_ALL, 'zh_CN.UTF-8', 'C.UTF-8');
require_once $_SERVER['DOCUMENT_ROOT'] . '/app/vendor/autoload.php'; require_once $_SERVER['DOCUMENT_ROOT'] . '/app/vendor/autoload.php';
require $_SERVER['DOCUMENT_ROOT'] . '/app/libs/uoj-lib.php'; require $_SERVER['DOCUMENT_ROOT'] . '/app/libs/uoj-lib.php';