Hint: both Message and Attachement classes have a method by that name.  :-)

- Sam Ruby

On Wed, May 10, 2017 at 8:51 PM, Craig Russell <apache....@gmail.com> wrote:
> Part of my confusion is this:
>
> in iclas.json.rb:
>
> # create/add file(s)
> if @signature.to_s.empty? or not @selected.end_with? '.pdf'
>       message.write_svn("#{dir}/iclas", @filename, @selected, @signature)
> else
>       message.write_svn("#{dir}/iclas", @filename,
> @selected => 'icla.pdf', @signature => 'icla.pdf.asc')
> end
>
> So it looks like the write_svn takes four arguments.
>
> But the function in attachment.rb looks like it expects three arguments:
>
>
>   def write_svn(repos, file, path=nil)
>     filename = File.join(repos, file)
>     filename = File.join(filename, path || safe_name) if Dir.exist? filename
>
>     raise Errno::EEXIST.new(file) if File.exist? filename
>     File.write filename, body, encoding: Encoding::BINARY
>
>     system 'svn', 'add', filename
>     system 'svn', 'propset', 'svn:mime-type', content_type.untaint, filename
>
>     filename
>   end
> end
>
> I'm sure I'm missing some trick about multiple final arguments. But I don't 
> see how write_svn works. :(
>
> Craig
>
>> On May 10, 2017, at 5:06 PM, Craig Russell <apache....@gmail.com> wrote:
>>
>> I suspect that the bug is somewhere in icla.json.rb where the selected file 
>> name ends with PDF not pdf.
>>
>>    # create/add file(s)
>>    if @signature.to_s.empty? or not @selected.end_with? '.pdf'
>>      message.write_svn("#{dir}/iclas", @filename, @selected, @signature)
>>    else
>>      message.write_svn("#{dir}/iclas", @filename,
>>        @selected => 'icla.pdf', @signature => 'icla.pdf.asc')
>>    end
>>
>> Is there supposed to be a .downcase somewhere around @selected.end_with?
>>
>> I don't understand the coding of this if/else block.
>>
>> If there is a signature file, create a directory and add two files named 
>> icla.pdf and icla.pdf.asc
>> If not, create a file called user-name.pdf
>>
>> I know what the intent is, I just cannot read the code.
>>
>> Craig
>>
>>> On May 10, 2017, at 4:42 PM, Craig Russell <apache....@gmail.com> wrote:
>>>
>>> This happens when submitter capitalizes PDF. The file that is created 
>>> incorrectly ends in .PDF but the svn command ends in pdf.
>>>
>>>      • $ svn checkout --depth empty 
>>> https://svn.apache.org/repos/private/documents/iclas 
>>> /tmp/d20170510-4903-qckx05/iclas
>>>
>>> Checked out revision 76572.
>>>
>>>
>>> $ svn status /tmp/d20170510-4903-qckx05/iclas
>>>
>>> A       /tmp/d20170510-4903-qckx05/iclas/dmitry-pavlov.PDF
>>>
>>>
>>> $ svn commit /tmp/d20170510-4903-qckx05/iclas/dmitry-pavlov.pdf -m 'ICLA 
>>> from Dmitry Pavlov'
>>>
>>> svn: E200009: Commit failed (details follow):
>>> svn: E200009: '/tmp/d20170510-4903-qckx05/iclas/dmitry-pavlov.pdf' is not 
>>> under version control
>>>
>>>
>>> Craig L Russell
>>> Secretary, Apache Software Foundation
>>> c...@apache.org http://db.apache.org/jdo
>>>
>>
>> Craig L Russell
>> Secretary, Apache Software Foundation
>> c...@apache.org http://db.apache.org/jdo
>>
>
> Craig L Russell
> Secretary, Apache Software Foundation
> c...@apache.org http://db.apache.org/jdo
>

Reply via email to