Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
arduino-cli
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Operations
Operations
Metrics
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
arduino-cli
Commits
658445cb
Unverified
Commit
658445cb
authored
Mar 19, 2021
by
Silvano Cerza
Committed by
GitHub
Mar 19, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix OS X metadata folder not ignored when installing lib from zip (#1228)
parent
2ed6dd0b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
0 deletions
+37
-0
arduino/libraries/librariesmanager/install.go
arduino/libraries/librariesmanager/install.go
+3
-0
test/test_lib.py
test/test_lib.py
+34
-0
test/testdata/fake-lib.zip
test/testdata/fake-lib.zip
+0
-0
No files found.
arduino/libraries/librariesmanager/install.go
View file @
658445cb
...
...
@@ -124,6 +124,9 @@ func (lm *LibrariesManager) InstallZipLib(ctx context.Context, archivePath strin
return
err
}
// Ignores metadata from Mac OS X
paths
.
FilterOutPrefix
(
"__MACOSX"
)
if
len
(
paths
)
>
1
{
return
fmt
.
Errorf
(
"archive is not valid: multiple files found in zip file top level"
)
}
...
...
test/test_lib.py
View file @
658445cb
...
...
@@ -834,3 +834,37 @@ def test_lib_upgrade_using_library_with_invalid_version(run_command, data_dir):
data
=
json
.
loads
(
res
.
stdout
)
assert
len
(
data
)
==
1
assert
""
!=
data
[
0
][
"library"
][
"version"
]
def
test_install_zip_lib_with_macos_metadata
(
run_command
,
data_dir
,
downloads_dir
):
# Initialize configs to enable --zip-path flag
env
=
{
"ARDUINO_DATA_DIR"
:
data_dir
,
"ARDUINO_DOWNLOADS_DIR"
:
downloads_dir
,
"ARDUINO_SKETCHBOOK_DIR"
:
data_dir
,
"ARDUINO_ENABLE_UNSAFE_LIBRARY_INSTALL"
:
"true"
,
}
assert
run_command
(
"config init --dest-dir ."
,
custom_env
=
env
)
lib_install_dir
=
Path
(
data_dir
,
"libraries"
,
"fake-lib"
)
# Verifies library is not already installed
assert
not
lib_install_dir
.
exists
()
zip_path
=
Path
(
__file__
).
parent
/
"testdata"
/
"fake-lib.zip"
# Test zip-path install
res
=
run_command
(
f"lib install --zip-path
{
zip_path
}
"
)
assert
res
.
ok
assert
"--git-url and --zip-path flags allow installing untrusted files, use it at your own risk."
in
res
.
stdout
# Verifies library is installed in expected path
assert
lib_install_dir
.
exists
()
files
=
list
(
lib_install_dir
.
glob
(
"**/*"
))
assert
lib_install_dir
/
"library.properties"
in
files
# Reinstall library
assert
run_command
(
f"lib install --zip-path
{
zip_path
}
"
)
# Verifies library remains installed
assert
lib_install_dir
.
exists
()
files
=
list
(
lib_install_dir
.
glob
(
"**/*"
))
assert
lib_install_dir
/
"library.properties"
in
files
test/testdata/fake-lib.zip
0 → 100644
View file @
658445cb
File added
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