fix extension matching?
This commit is contained in:
parent
64c5370a94
commit
45257627f3
1 changed files with 15 additions and 12 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
#!/usr/local/bin/ruby -w
|
#!/usr/local/bin/ruby -w
|
||||||
|
|
||||||
# $Dwarf: ripnews.rb,v 1.39 2003/03/20 21:53:51 ward Exp $
|
# $Dwarf: ripnews.rb,v 1.40 2003/03/21 12:51:21 ward Exp $
|
||||||
# $Source$
|
# $Source$
|
||||||
|
|
||||||
require 'date'
|
require 'date'
|
||||||
|
|
@ -246,10 +246,12 @@ def get_multi(subj, group)
|
||||||
if @articles.is_uuencoded(body)
|
if @articles.is_uuencoded(body)
|
||||||
mode, filename, body = @articles.uudecode(body)
|
mode, filename, body = @articles.uudecode(body)
|
||||||
return false unless check_ext(group, filename, "m")
|
return false unless check_ext(group, filename, "m")
|
||||||
|
print " should have a match here else something's wrong\n"
|
||||||
return mode, filename, body
|
return mode, filename, body
|
||||||
elsif @articles.is_yencoded(body)
|
elsif @articles.is_yencoded(body)
|
||||||
mode, filename, body = @articles.ydecode(body)
|
mode, filename, body = @articles.ydecode(body)
|
||||||
return false unless check_ext(group, filename, "m")
|
return false unless check_ext(group, filename, "m")
|
||||||
|
print " should have a match here else something's wrong\n"
|
||||||
return mode, filename, body
|
return mode, filename, body
|
||||||
end
|
end
|
||||||
print " Unknown encoding (not UU, not yEnc), skipping...\n"
|
print " Unknown encoding (not UU, not yEnc), skipping...\n"
|
||||||
|
|
@ -269,6 +271,7 @@ def get_multi(subj, group)
|
||||||
end
|
end
|
||||||
# in plaats van hier
|
# in plaats van hier
|
||||||
return false unless check_ext(group, filename, "m")
|
return false unless check_ext(group, filename, "m")
|
||||||
|
print " should have a match here else something's wrong\n"
|
||||||
body = fileout.path
|
body = fileout.path
|
||||||
bodybase = body.sub(/\/[^\/]*$/, "")
|
bodybase = body.sub(/\/[^\/]*$/, "")
|
||||||
File.rename(body, "#{bodybase}/ripnewsdecode")
|
File.rename(body, "#{bodybase}/ripnewsdecode")
|
||||||
|
|
@ -322,24 +325,24 @@ def output_data(subject, mode, filename="", body="")
|
||||||
end
|
end
|
||||||
|
|
||||||
def check_ext(group, filename, mode)
|
def check_ext(group, filename, mode)
|
||||||
print "filename: #{filename}\n";
|
print " filename: #{filename}\n";
|
||||||
case mode
|
case mode
|
||||||
when "s"
|
when "s"
|
||||||
print "sould have extension: #{@config[group]["-S"]}\n";
|
print " sould have extension: #{@config[group]["-S"]}\n";
|
||||||
if ( filename =~ /\.(#{@config[group]["-S"]})$/ )
|
if ( @config[group].has_key?("-S") && filename =~ /\.(#{@config[group]["-S"]})$/ )
|
||||||
print "extension matches\n"
|
print " extension matches\n"
|
||||||
else
|
else
|
||||||
print "extension doesn't match\n"
|
print " extension doesn't match\n"
|
||||||
end
|
end
|
||||||
return @config.has_key?("-S") ? filename =~ /\.(#{@config[group]["-S"]})$/ : true
|
return @config[group].has_key?("-S") ? ( filename =~ /\.(#{@config[group]["-S"]})$/ ) : true
|
||||||
when "m"
|
when "m"
|
||||||
if ( filename =~ /\.(#{@config[group]["-M"]})$/ )
|
print " sould have extension: #{@config[group]["-M"]}\n";
|
||||||
print "extension matches\n"
|
if ( @config[group].has_key?("-S") && filename =~ /\.(#{@config[group]["-M"]})$/ )
|
||||||
|
print " extension matches\n"
|
||||||
else
|
else
|
||||||
print "extension doesn't match\n"
|
print " extension doesn't match\n"
|
||||||
end
|
end
|
||||||
print "sould have extension: #{@config[group]["-M"]}\n";
|
return @config[group].has_key?("-M") ? ( filename =~ /\.(#{@config[group]["-M"]})$/ ) : true
|
||||||
return @config.has_key?("-M") ? filename =~ /\.(#{@config[group]["-M"]})$/ : true
|
|
||||||
else
|
else
|
||||||
print "Illegal mode \"#{mode}\" in check_ext\n"
|
print "Illegal mode \"#{mode}\" in check_ext\n"
|
||||||
exit
|
exit
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue