mirror of
https://github.com/linuxserver/Heimdall.git
synced 2026-02-21 12:10:34 +09:00
fix: Enable tag slug creation from CN characters (#1077)
This commit is contained in:
@@ -4,13 +4,11 @@ namespace App\Http\Controllers;
|
||||
|
||||
use App\Item;
|
||||
use App\User;
|
||||
use DB;
|
||||
use Illuminate\Contracts\Foundation\Application;
|
||||
use Illuminate\Contracts\View\Factory;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class TagController extends Controller
|
||||
{
|
||||
@@ -68,7 +66,7 @@ class TagController extends Controller
|
||||
]);
|
||||
}
|
||||
|
||||
$slug = str_slug($request->title, '-');
|
||||
$slug = str_slug($request->title, '-', 'en_US');
|
||||
|
||||
$current_user = User::currentUser();
|
||||
|
||||
@@ -140,7 +138,7 @@ class TagController extends Controller
|
||||
]);
|
||||
}
|
||||
|
||||
$slug = str_slug($request->title, '-');
|
||||
$slug = str_slug($request->title, '-', 'en_US');
|
||||
// set item type to tag
|
||||
$request->merge([
|
||||
'url' => $slug,
|
||||
|
||||
18
tests/Unit/helpers/SlugTest.php
Normal file
18
tests/Unit/helpers/SlugTest.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\helpers;
|
||||
|
||||
use Tests\TestCase;
|
||||
|
||||
class SlugTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function test_slug_returns_valid_tag_for_cn_characters_when_language_is_set_to_en_US()
|
||||
{
|
||||
$tag = str_slug('中文測試', '-', 'en_US');
|
||||
|
||||
$this->assertEquals('zhong-wen-ce-shi', $tag);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user