Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
ppt_server
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Li Feifei
ppt_server
Commits
7746414d
Commit
7746414d
authored
Jul 26, 2021
by
Li Feifei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复中文文件名无法被解析
parent
61d555f3
Pipeline
#15612
passed with stages
in 38 seconds
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
7 deletions
+7
-7
file_parser.go
packed/file/file_parser.go
+3
-4
file_upload.go
packed/file/file_upload.go
+4
-3
No files found.
packed/file/file_parser.go
View file @
7746414d
...
...
@@ -47,9 +47,8 @@ func parseURL(ossFileLink, name string) (*parser, error) {
//解析课件的URL
func
(
f
*
parser
)
splitFileInfoLink
()
string
{
return
fmt
.
Sprintf
(
"%s?info=0&ssl=1&furl=%s/%s"
,
ParserFileLink
,
g
.
Cfg
()
.
GetString
(
"oss.url"
),
f
.
splitUploadPath
()
+
gurl
.
Encode
(
f
.
slicePath
[
len
(
f
.
slicePath
)
-
1
:
][
0
]))
return
fmt
.
Sprintf
(
"%s?info=0&ssl=1&furl=%s%s"
,
ParserFileLink
,
g
.
Cfg
()
.
GetString
(
"oss.url"
),
f
.
dataPath
())
}
// 临时存储解析包地址
...
...
@@ -74,7 +73,7 @@ func (f *parser) contentHash() string {
// 数据库存储path
func
(
f
*
parser
)
dataPath
()
string
{
return
f
.
path
[
1
:
]
return
"/"
+
f
.
splitUploadPath
()
+
gurl
.
Encode
(
f
.
slicePath
[
len
(
f
.
slicePath
)
-
1
:
][
0
])
}
// 解析doctype
...
...
packed/file/file_upload.go
View file @
7746414d
...
...
@@ -9,7 +9,6 @@ import (
"image/jpeg"
"image/png"
"io/ioutil"
"os"
"path"
"regexp"
"strings"
...
...
@@ -155,6 +154,8 @@ func (f *ObtainFile) task(file *zip.File) error {
}
func
(
f
*
ObtainFile
)
uploadPicture
()
error
{
fmt
.
Println
(
f
.
parser
.
splitTempZipLink
())
reader
,
err
:=
zip
.
OpenReader
(
f
.
parser
.
splitTempZipLink
())
if
err
!=
nil
{
return
err
...
...
@@ -194,7 +195,7 @@ func (f *ObtainFile) Worker(err error) {
downloadZipLink
:=
fmt
.
Sprintf
(
"%s?info=1&words=%v&ssl=1&furl=%s/%s"
,
ParserFileLink
,
f
.
pageCount
,
g
.
Cfg
()
.
GetString
(
"oss.url"
),
f
.
parser
.
dataPath
)
f
.
parser
.
dataPath
()
)
// 下载ZIP包
if
err
=
http
.
Download
(
downloadZipLink
,
f
.
parser
.
splitTempZipLink
());
err
!=
nil
{
...
...
@@ -203,7 +204,7 @@ func (f *ObtainFile) Worker(err error) {
return
}
// 清理ZIP包
defer
os
.
Remove
(
f
.
parser
.
splitTempZipLink
())
//
defer os.Remove(f.parser.splitTempZipLink())
g
.
Log
()
.
Async
()
.
Infof
(
"file: %s Zip Donwload Complete"
,
f
.
parser
.
name
)
// 解析ZIP包并上传图片到OSS
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment