Fixes issue with special characters in URL for file manager

closes #21
This commit is contained in:
Dane Everitt 2016-01-17 22:54:03 -05:00
parent 776af7d0f1
commit 4f3629fc4c
3 changed files with 9 additions and 9 deletions

View File

@ -143,7 +143,7 @@ class FileRepository
throw new Exception('A valid directory must be specified in order to list its contents.'); throw new Exception('A valid directory must be specified in order to list its contents.');
} }
$res = $this->client->request('GET', '/server/directory/' . $directory, [ $res = $this->client->request('GET', '/server/directory/' . rawurlencode($directory), [
'headers' => $this->headers 'headers' => $this->headers
]); ]);

View File

@ -29,8 +29,8 @@
<div> <div>
<input type="hidden" name="file" value="{{ $file }}" /> <input type="hidden" name="file" value="{{ $file }}" />
{!! csrf_field() !!} {!! csrf_field() !!}
<button class="btn btn-primary btn-sm" id="save_file">{{ trans('strings.save') }}</button> <button class="btn btn-primary btn-sm" id="save_file" type="submit">{{ trans('strings.save') }}</button>
<button class="btn btn-default btn-sm" onclick="window.location='/server/{{ $server->uuidShort }}/files?dir={{ urlencode($directory) }}';return false;">{{ trans('server.files.back') }}</button> <a href="/server/{{ $server->uuidShort }}/files?dir={{ rawurlencode($directory) }}"><button class="btn btn-default btn-sm">{{ trans('server.files.back') }}</button></a>
</div> </div>
</div> </div>
@endcan @endcan

View File

@ -22,7 +22,7 @@
@if (isset($directory['show']) && $directory['show'] === true) @if (isset($directory['show']) && $directory['show'] === true)
<tr> <tr>
<td><i class="fa fa-folder-open" style="margin-left: 0.859px;"></i></td> <td><i class="fa fa-folder-open" style="margin-left: 0.859px;"></i></td>
<td><a href="/server/{{ $server->uuidShort }}/files?dir={{ $directory['link'] }}" class="load_new">&larr; {{ $directory['link_show'] }}</a></a></td> <td><a href="/server/{{ $server->uuidShort }}/files?dir={{ rawurlencode($directory['link']) }}" class="load_new">&larr; {{ $directory['link_show'] }}</a></a></td>
<td></td> <td></td>
<td></td> <td></td>
<td></td> <td></td>
@ -31,7 +31,7 @@
@foreach ($folders as $folder) @foreach ($folders as $folder)
<tr> <tr>
<td><i class="fa fa-folder-open" style="margin-left: 0.859px;"></i></td> <td><i class="fa fa-folder-open" style="margin-left: 0.859px;"></i></td>
<td><a href="/server/{{ $server->uuidShort }}/files?dir=/@if($folder['directory'] !== ''){{ $folder['directory'] }}/@endif{{ $folder['entry'] }}" class="load_new">{{ $folder['entry'] }}</a></td> <td><a href="/server/{{ $server->uuidShort }}/files?dir=/@if($folder['directory'] !== ''){{ rawurlencode($folder['directory']) }}/@endif{{ rawurlencode($folder['entry']) }}" class="load_new">{{ $folder['entry'] }}</a></td>
<td>{{ $folder['size'] }}</td> <td>{{ $folder['size'] }}</td>
<td>{{ date('m/d/y H:i:s', $folder['date']) }}</td> <td>{{ date('m/d/y H:i:s', $folder['date']) }}</td>
<td style="text-align:center;"> <td style="text-align:center;">
@ -41,7 +41,7 @@
</div> </div>
<div class="col-md-3"> <div class="col-md-3">
@can('delete-files', $server) @can('delete-files', $server)
<a href="@if($folder['directory'] !== ''){{ $folder['directory'] }}/@endif{{ $folder['entry'] }}" class="delete_file"><span class="badge label-danger"><i class="fa fa-trash-o"></i></span></a> <a href="@if($folder['directory'] !== ''){{ rawurlencode($folder['directory']) }}/@endif{{ rawurlencode($folder['entry']) }}" class="delete_file"><span class="badge label-danger"><i class="fa fa-trash-o"></i></span></a>
@endcan @endcan
</div> </div>
</div> </div>
@ -54,7 +54,7 @@
<td> <td>
@if(in_array($file['extension'], $extensions)) @if(in_array($file['extension'], $extensions))
@can('edit-files', $server) @can('edit-files', $server)
<a href="/server/{{ $server->uuidShort }}/files/edit/@if($file['directory'] !== ''){{ $file['directory'] }}/@endif{{ $file['entry'] }}" class="edit_file">{{ $file['entry'] }}</a> <a href="/server/{{ $server->uuidShort }}/files/edit/@if($file['directory'] !== ''){{ rawurlencode($file['directory']) }}/@endif{{ rawurlencode($file['entry']) }}" class="edit_file">{{ $file['entry'] }}</a>
@else @else
{{ $file['entry'] }} {{ $file['entry'] }}
@endcan @endcan
@ -70,12 +70,12 @@
</div> </div>
<div class="col-md-3 hidden-xs hidden-sm"> <div class="col-md-3 hidden-xs hidden-sm">
@can('download-files', $server) @can('download-files', $server)
<a href="/server/{{ $server->uuidShort }}/files/download/@if($file['directory'] !== ''){{ $file['directory'] }}/@endif{{ $file['entry'] }}"><span class="badge"><i class="fa fa-download"></i></span></a> <a href="/server/{{ $server->uuidShort }}/files/download/@if($file['directory'] !== ''){{ rawurlencode($file['directory']) }}/@endif{{ rawurlencode($file['entry']) }}"><span class="badge"><i class="fa fa-download"></i></span></a>
@endcan @endcan
</div> </div>
<div class="col-md-3"> <div class="col-md-3">
@can('delete-files', $server) @can('delete-files', $server)
<a href="@if($file['directory'] !== ''){{ $file['directory'] }}/@endif{{ $file['entry'] }}" class="delete_file"><span class="badge label-danger"><i class="fa fa-trash-o"></i></span> <a href="@if($file['directory'] !== ''){{ rawurlencode($file['directory']) }}/@endif{{ rawurlencode($file['entry']) }}" class="delete_file"><span class="badge label-danger"><i class="fa fa-trash-o"></i></span>
@endcan @endcan
</div> </div>
</div> </div>