Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-unixfs
Commits
c40e6b58
Commit
c40e6b58
authored
Aug 30, 2015
by
Jeromy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
give ipfs get symlink support
License: MIT Signed-off-by:
Jeromy
<
jeromyj@gmail.com
>
parent
7fd69506
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
0 deletions
+11
-0
archive/tar/writer.go
archive/tar/writer.go
+11
-0
No files found.
archive/tar/writer.go
View file @
c40e6b58
...
...
@@ -79,6 +79,8 @@ func (w *Writer) WriteNode(nd *mdag.Node, fpath string) error {
fallthrough
case
upb
.
Data_File
:
return
w
.
writeFile
(
nd
,
pb
,
fpath
)
case
upb
.
Data_Symlink
:
return
writeSymlinkHeader
(
w
.
TarW
,
string
(
pb
.
GetData
()),
fpath
)
default
:
return
ft
.
ErrUnrecognizedType
}
...
...
@@ -108,3 +110,12 @@ func writeFileHeader(w *tar.Writer, fpath string, size uint64) error {
// TODO: set mode, dates, etc. when added to unixFS
})
}
func
writeSymlinkHeader
(
w
*
tar
.
Writer
,
target
,
fpath
string
)
error
{
return
w
.
WriteHeader
(
&
tar
.
Header
{
Name
:
fpath
,
Linkname
:
target
,
Mode
:
0777
,
Typeflag
:
tar
.
TypeSymlink
,
})
}
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