good morning!!!!
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
goutil
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
open
goutil
Commits
f31f630b
Commit
f31f630b
authored
Mar 5, 2022
by
a
Browse files
Options
Downloads
Patches
Plain Diff
remove another copy
parent
02837c79
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
filing/fs_weed/formdata.go
+10
-14
10 additions, 14 deletions
filing/fs_weed/formdata.go
filing/fs_weed/weed.go
+6
-5
6 additions, 5 deletions
filing/fs_weed/weed.go
with
16 additions
and
19 deletions
filing/fs_weed/formdata.go
+
10
−
14
View file @
f31f630b
package
fs_weed
package
fs_weed
import
(
import
(
"bytes"
"fmt"
"fmt"
"io"
"io"
"log"
"mime/multipart"
"mime/multipart"
"net/textproto"
"net/textproto"
"gitlab.com/gfxlabs/goutil/bufpool"
)
)
func
makeFormData
(
func
makeFormData
(
filename
,
mimeType
string
,
filename
,
mimeType
string
,
content
io
.
Reader
,
content
[]
byte
,
)
(
formData
*
b
ytes
.
Buffer
,
contentType
string
,
err
error
)
{
)
(
formData
*
b
ufpool
.
PooledBuffer
,
err
error
)
{
buf
:=
new
(
bytes
.
Buffer
)
buf
:=
BUFPOOL
.
Get
(
)
writer
:=
multipart
.
NewWriter
(
buf
)
writer
:=
multipart
.
NewWriter
(
buf
)
defer
writer
.
Close
()
part
,
err
:=
createFormFile
(
writer
,
"file"
,
filename
,
mimeType
)
part
,
err
:=
createFormFile
(
writer
,
"file"
,
filename
,
mimeType
)
if
err
!=
nil
{
if
err
!=
nil
{
log
.
Println
(
err
)
return
buf
,
err
return
}
}
_
,
err
=
io
.
Copy
(
part
,
content
)
_
,
err
=
part
.
Write
(
content
)
if
err
!=
nil
{
if
err
!=
nil
{
log
.
Println
(
err
)
return
buf
,
err
return
}
}
formData
=
buf
return
buf
,
err
contentType
=
writer
.
FormDataContentType
()
writer
.
Close
()
return
}
}
func
createFormFile
(
writer
*
multipart
.
Writer
,
fieldname
,
filename
,
mime
string
)
(
io
.
Writer
,
error
)
{
func
createFormFile
(
writer
*
multipart
.
Writer
,
fieldname
,
filename
,
mime
string
)
(
io
.
Writer
,
error
)
{
...
...
This diff is collapsed.
Click to expand it.
filing/fs_weed/weed.go
+
6
−
5
View file @
f31f630b
package
fs_weed
package
fs_weed
import
(
import
(
"bytes"
"encoding/json"
"encoding/json"
"errors"
"errors"
"io"
"io"
...
@@ -115,11 +114,13 @@ func (F *FS) get(file string) (http.Header, []byte, error) {
...
@@ -115,11 +114,13 @@ func (F *FS) get(file string) (http.Header, []byte, error) {
func
(
F
*
FS
)
push
(
func
(
F
*
FS
)
push
(
file
,
content
string
,
dat
[]
byte
,
file
,
content
string
,
dat
[]
byte
,
)
(
http
.
Header
,
[]
byte
,
error
)
{
)
(
http
.
Header
,
[]
byte
,
error
)
{
if
content
==
""
{
contentType
:=
content
content
=
http
.
DetectContentType
(
dat
)
if
contentType
==
""
{
contentType
=
http
.
DetectContentType
(
dat
)
}
}
sum
:=
meow
.
Checksum64
(
THREEBEEF
,
dat
)
sum
:=
meow
.
Checksum64
(
THREEBEEF
,
dat
)
d
,
ct
,
err
:=
makeFormData
(
normalizeName
(
file
),
content
,
bytes
.
NewBuffer
(
dat
))
d
,
err
:=
makeFormData
(
normalizeName
(
file
),
contentType
,
dat
)
defer
d
.
Release
()
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
nil
,
err
return
nil
,
nil
,
err
}
}
...
@@ -134,7 +135,7 @@ func (F *FS) push(
...
@@ -134,7 +135,7 @@ func (F *FS) push(
return
nil
,
nil
,
err
return
nil
,
nil
,
err
}
}
req
.
Header
.
Set
(
"Seaweed-Meow64"
,
strconv
.
FormatUint
(
sum
,
10
))
req
.
Header
.
Set
(
"Seaweed-Meow64"
,
strconv
.
FormatUint
(
sum
,
10
))
req
.
Header
.
Set
(
"Content-Type"
,
c
t
)
req
.
Header
.
Set
(
"Content-Type"
,
c
ontentType
)
resp
,
err
:=
F
.
client
.
Do
(
req
)
resp
,
err
:=
F
.
client
.
Do
(
req
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
nil
,
err
return
nil
,
nil
,
err
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment