salesforce / vulnreport

Open-source pentesting management and automation platform by Salesforce Product Security
http://vulnreport.io
BSD 3-Clause "New" or "Revised" License
592 stars 155 forks source link

NameError at /admin/exportFormats/new undefined local variable or method `filename' #6

Closed alienelephant closed 7 years ago

alienelephant commented 7 years ago

When attempting to create a new Export Format, this error is presented:

NameError at /admin/exportFormats/new
undefined local variable or method `filename' for #<Vulnreport:0x007ff978655a08>
file: admin.rb location: block in <class:Vulnreport> line: 1181

Backtrace:

/home/gaten/vulnreport/routes/admin.rb in block in <class:Vulnreport>
            @errstr = "Record Type must have a name"
            return erb :error
        end

        defaultFile = File.open("exportTemplates/default.erb", "rb")
        defaultContents = defaultFile.read
        ef = ExportFormat.create(:name => name, :description => desc, :filename => filename, :erb => defaultContents)
        redirect "/admin/exportFormats/#{ef.id}"
    end

    get '/admin/exportFormats/:efid/?' do
        efid = params[:efid].to_i

        if(efid != 0)
            @ef = ExportFormat.get(efid)

POST:

Variable    Value
_csrf   
"8cBBjRzzJ/MbxXnB0NgvrT+Rv574GlQfqwyqCkK6Klw="
efDesc  
"Test Description"
efName  
"Test Name"
save    
"save"
tbach commented 7 years ago

Hi @alienelephant,

Thanks for reporting this. This was caused by some stale code that somehow slipped past an earlier revision. I've pushed a fix.

Tim

alienelephant commented 7 years ago

I just found the code myself- talk about fast response time! Thank you!