Merge pull request #12516 from inietov/fixes/quotes_in_custom_field_custom_regex

Fixed #12252 Quotes in Custom Field regex are being HTML-escaped
This commit is contained in:
snipe 2023-02-14 20:10:43 -08:00 committed by GitHub
commit 1ed57d30e0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 35 additions and 2 deletions

View file

@ -109,9 +109,9 @@ class CustomFieldsController extends Controller
if ($request->filled('custom_format')) { if ($request->filled('custom_format')) {
$field->format = e($request->get('custom_format')); $field->format = $request->get('custom_format');
} else { } else {
$field->format = e($request->get('format')); $field->format = $request->get('format');
} }
if ($field->save()) { if ($field->save()) {

View file

@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use App\Models\CustomField;
class FixUnescapedCustomfieldsFormat extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
$customfields = CustomField::where('format', 'LIKE', '%&%')->get();
foreach($customfields as $customfield){
$customfield->update(['format' => html_entity_decode($customfield->format)]);
}
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}