On Fri, Oct 16, 2020 at 2:36 PM nilsocket <
nils...@gmail.com> wrote:
>
> I was trying to create a package which sanitizes file name, for testing purposes, I choose blns.
>
> I create a directory, named "blns" and sanitize names from blns and create those files in "blns" directory.
>
> I have tested 516 strings in Linux, everything worked fine, for sake of cross-compatibility I choose to test in windows, then I got this problem.
>
> I was able to create 515 files in "blns" directory but this one.
>
> Since You were not able to reproduce, I will consider some kind of problem with windows OS and skip it, as this is error is from windows system calls.
I don't think you understand the earlier comment, so I will restate it.
Your sample code says
os.MkdirAll(dir, os.ModePerm)
Do not do that.
Instead write
if err := os.MkdirAll(dir, os.ModePerm); err != nil {
log.Println(err)
return
}
Ian
> On Friday, October 16, 2020 at 8:39:03 AM UTC+5:30 Kurtis Rader wrote:
>>
>> On Thu, Oct 15, 2020 at 8:00 PM nilsocket <
nils...@gmail.com> wrote:
>>>
>>> No, dir "a" is being created.
>>
>>
>> Yes, I understand you are trying to create the directory. My point is that you don't verify that the `os.MkdirAll` call succeeds. On my Windows 10 system your program works fine unless I create a file named "a" before running your program. Please modify your program to check the error value returned by `os.MkdirAll` and verify that it is nil.
>>
>>>
>>> Intact, I was testing out big list of naughty strings, I didn't have problem with any string but this one.
>>>
>>> Regarding error, I don't mean error is "linked picture", I mean, for error one can look at the picture which I have linked.
>>
>>
>> That wasn't obvious at first glance. The indirection also wasn't necessary. All you had to do was write that the error was something like this (what I saw when I deliberately induced a failure by running "touch a"):
>>
>> 2020/10/15 19:32:16 open a\408_-IMG SRC=javasc�
>> 114ipt:alert(�
>> 39XSS')-: The system cannot find the path specified.
>>
>> --
>> Kurtis Rader
>> Caretaker of the exceptional canines Junior and Hank
>
> --
> You received this message because you are subscribed to the Google Groups "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
golang-nuts...@googlegroups.com.
> To view this discussion on the web visit
https://groups.google.com/d/msgid/golang-nuts/bf97b64b-b243-4b67-8c7e-d6e7e3895aecn%40googlegroups.com.