Skip to content

Commit

Permalink
closes #1031 (#1032)
Browse files Browse the repository at this point in the history
fixes an issue with file paths to ignore when the file has no extension
the issue was due to  trying to add a  when it got a path
that did not start with a  and that did not have an extension
already (this is incidentally why this wasn't flagged for
)
  • Loading branch information
tlienart authored Jun 26, 2023
1 parent b67570e commit 5629fc5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "Franklin"
uuid = "713c75ef-9fc9-4b05-94a9-213340da978e"
authors = ["Thibaut Lienart <[email protected]>"]
version = "0.10.84"
version = "0.10.85"

[deps]
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
Expand Down
6 changes: 4 additions & 2 deletions src/eval/io.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,17 @@ $(SIGNATURES)
Internal function to take a relative path and return a unix version of the path
(if it isn't already). Used in [`resolve_rpath`](@ref).
"""
function unixify(rpath::AS)::AS
function unixify(rpath::AS; allow_noext::Bool=false)::AS
# if empty, return "/"
isempty(rpath) && return "/"
# if windows, replace "\\" by "/"
Sys.isunix() || (rpath = replace(rpath, "\\" => "/"))
# if it's a path to a dot file, like path/.gitignore, return (issue #1001)
startswith(splitdir(rpath)[2], ".") && return rpath
startswith(splitdir(rpath)[2], ".") && return rpath
# if it has an extension e.g.: /blah.txt, return
isempty(splitext(rpath)[2]) || return rpath
# if an extension-less path is allowed, return (issue #1031)
allow_noext && return rpath
# if it doesn't have an extension, check if it ends with `/` e.g. : /blah/
# if it doesn't end with "/", add one and return
endswith(rpath, "/") || return rpath * "/"
Expand Down
3 changes: 2 additions & 1 deletion src/manager/dir_utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,8 @@ Rules:
function should_ignore(fpath::AS, files2ignore::Vector,
dirs2ignore::Vector)::Bool
# fpath is necessarily an absolute path so can strip the folder part
fpath = fpath[length(path(:folder))+length(PATH_SEP)+1:end] |> unixify
fpath = fpath[length(path(:folder))+length(PATH_SEP)+1:end]
fpath = unixify(fpath; allow_noext=true)
if any(c -> c isa Regex ? match(c, fpath) !== nothing : c == fpath,
files2ignore)
return true
Expand Down

2 comments on commit 5629fc5

@tlienart
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/86322

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.10.85 -m "<description of version>" 5629fc51904f454b299c020f60061ca0701cafcc
git push origin v0.10.85

Please sign in to comment.