-
Notifications
You must be signed in to change notification settings - Fork 251
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error when using "Copy URL to Clipboard" option for a root folder as / on Filemanager #258
Comments
Hm, I can't reproduce the issue. Btw, what RFM version do you use and what is your OS? |
Have you solved your issue? Let us know what was the reason. |
Nothing in the Javascript console to explain why the link is work. I'm using RFM 2.6.3 on Debian 9. My filemanager.php file: <?php
/**
* Entry point for PHP connector, put your customizations here.
*
* @license MIT License
* @author Pavel Solomienko <https://github.com/servocoder/>
* @copyright Authors
*/
// only for debug
// error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);
// ini_set('display_errors', '1');
require 'vendor/autoload.php';
// fix display non-latin chars correctly
// https://github.com/servocoder/RichFilemanager/issues/7
setlocale(LC_CTYPE, 'en_US.UTF-8');
// fix for undefined timezone in php.ini
// https://github.com/servocoder/RichFilemanager/issues/43
if(!ini_get('date.timezone')) {
date_default_timezone_set('GMT');
}
// This function is called for every server connection. It must return true.
//
// Implement this function to authenticate the user, for example to check a
// password login, or restrict client IP address.
//
// This function only authorizes the user to connect and/or load the initial page.
// Authorization for individual files or dirs is provided by the two functions below.
//
// NOTE: If using session variables, the session must be started first (session_start()).
function fm_authenticate()
{
// Customize this code as desired.
return true;
// If this function returns false, the user will just see an error.
// If this function returns an array with "redirect" key, the user will be redirected to the specified URL:
// return ['redirect' => 'http://domain.my/login'];
}
// This function is called before any filesystem read operation, where
// $filepath is the file or directory being read. It must return true,
// otherwise the read operation will be denied.
//
// Implement this function to do custom individual-file permission checks, such as
// user/group authorization from a database, or session variables, or any other custom logic.
//
// Note that this is not the only permissions check that must pass. The read operation
// must also pass:
// * Filesystem permissions (if any), e.g. POSIX `rwx` permissions on Linux
// * The $filepath must be allowed according to config['patterns'] and config['extensions']
//
function fm_has_read_permission($filepath)
{
// Customize this code as desired.
return true;
}
// This function is called before any filesystem write operation, where
// $filepath is the file or directory being written to. It must return true,
// otherwise the write operation will be denied.
//
// Implement this function to do custom individual-file permission checks, such as
// user/group authorization from a database, or session variables, or any other custom logic.
//
// Note that this is not the only permissions check that must pass. The write operation
// must also pass:
// * Filesystem permissions (if any), e.g. POSIX `rwx` permissions on Linux
// * The $filepath must be allowed according to config['patterns'] and config['extensions']
// * config['read_only'] must be set to false, otherwise all writes are disabled
//
function fm_has_write_permission($filepath)
{
// Customize this code as desired.
return true;
}
$config = [];
// example to override the default config
//$config = [
// 'security' => [
// 'readOnly' => true,
// 'extensions' => [
// 'policy' => 'ALLOW_LIST',
// 'restrictions' => [
// 'jpg',
// 'jpe',
// 'jpeg',
// 'gif',
// 'png',
// ],
// ],
// ],
//];
$app = new \RFM\Application();
$local = new \RFM\Repository\Local\Storage($config);
$local->setRoot('/var/www/drive/vividec76@gmail.com', true, false);
$app->setStorage($local);
$app->api = new RFM\Api\LocalApi();
$app->run(); Filemanager.config.json: {
"_comment": "IMPORTANT : go to the wiki page to know about options configuration https://github.com/servocoder/RichFilemanager/wiki/Configuration-options",
"options": {
"theme": "flat-dark",
"showTitleAttr": false,
"showConfirmation": true,
"browseOnly": false,
"searchBox": true,
"fileSorting": "NAME_ASC",
"folderPosition": "bottom",
"quickSelect": false,
"logger": false,
"allowFolderDownload": true,
"allowChangeExtensions": false,
"capabilities": [
"select",
"upload",
"download",
"rename",
"copy",
"move",
"delete",
"extract"
]
},
"language": {
"default": "en",
"available": ["ar", "bs", "ca", "cs", "da", "de", "el", "en", "es", "fa", "fi", "fr", "he", "hu", "it", "ja", "nl", "pl", "pt", "ru", "sv", "th", "tr", "vn", "zh-cn", "zh-tw"]
},
"filetree": {
"enabled": true,
"foldersOnly": false,
"reloadOnClick": true,
"expandSpeed": 200,
"showLine": true,
"width": 200,
"minWidth": 200
},
"manager": {
"defaultViewMode": "grid",
"dblClickOpen": false,
"selection": {
"enabled": true,
"useCtrlKey": true
},
"renderer": {
"position": false,
"indexFile": "readme.md"
}
},
"api": {
"lang": "php",
"connectorUrl": false,
"requestParams": {
"GET": {},
"POST": {},
"MIXED": {}
}
},
"upload": {
"multiple": true,
"maxNumberOfFiles": 5,
"chunkSize": false
},
"clipboard": {
"enabled": true,
"encodeCopyUrl": true
},
"filter": {
"image": ["jpg", "jpeg", "gif", "png", "svg"],
"media": ["ogv", "avi", "mkv", "mp4", "webm", "m4v", "ogg", "mp3", "wav"],
"office": ["txt", "pdf", "odp", "ods", "odt", "rtf", "doc", "docx", "xls", "xlsx", "ppt", "pptx", "csv", "md"],
"archive": ["zip", "tar", "rar"],
"audio": ["ogg", "mp3", "wav"],
"video": ["ogv", "avi", "mkv", "mp4", "webm", "m4v"]
},
"viewer": {
"absolutePath": true,
"previewUrl": false,
"image": {
"enabled": true,
"lazyLoad": true,
"showThumbs": true,
"thumbMaxWidth": 64,
"extensions": [
"jpg",
"jpe",
"jpeg",
"gif",
"png",
"svg"
]
},
"video": {
"enabled": true,
"extensions": [
"ogv",
"mp4",
"webm",
"m4v"
],
"playerWidth": 400,
"playerHeight": 222
},
"audio": {
"enabled": true,
"extensions": [
"ogg",
"mp3",
"wav"
]
},
"iframe": {
"enabled": true,
"extensions": [
"htm",
"html"
],
"readerWidth": "95%",
"readerHeight": "600"
},
"onlyoffice": {
"enabled": false,
"extensions": [
"doc",
"docx",
"odt",
"rtf",
"txt",
"pdf",
"html",
"epub",
"xps",
"djvu",
"xls",
"xlsx",
"ods",
"csv",
"pptx",
"ppt",
"odp"
],
"editorWidth": "95%",
"editorHeight": "600",
"apiUrl": "https://doc.onlyoffice.com/web-apps/apps/api/documents/api.js",
"connectorUrl": false,
"downloadUrl": false,
"callbackUrl": false
},
"opendoc": {
"enabled": true,
"extensions": [
"pdf",
"odt",
"odp",
"ods"
],
"readerWidth": "640",
"readerHeight": "480"
},
"google": {
"enabled": true,
"extensions": [
"doc",
"docx",
"xls",
"xlsx",
"ppt",
"pptx"
],
"readerWidth": "640",
"readerHeight": "480"
},
"codeMirrorRenderer": {
"enabled": true,
"extensions": [
"txt",
"csv"
]
},
"markdownRenderer": {
"enabled": true,
"extensions": [
"md"
]
}
},
"editor": {
"enabled": true,
"theme": "default",
"lineNumbers": true,
"lineWrapping": true,
"codeHighlight": true,
"matchBrackets": true,
"extensions": [
"html",
"txt",
"csv",
"md"
]
},
"customScrollbar": {
"enabled": true,
"theme": "inset-2-dark",
"button": true
},
"extras": {
"extra_js": [],
"extra_js_async": true
},
"url": "https://github.com/servocoder/RichFilemanager",
"version": "2.6.3"
} Moreover, these file extensions are not showed by RichFilemanager: |
To show extensions that you wish you have to specify them in the $config = [
'security' => [
'extensions' => [
'policy' => 'ALLOW_LIST',
'restrictions' => [
'jpg',
'jpe',
'jpeg',
'gif',
'png',
],
],
],
]; in filemanager.php file. There are much more server-side configuration options available. I believe you missed the PHP-connector guidelines. Please read it thoroughly. |
As to your initial complaint. Your configs looks quite default. I have to ask few additinal questions:
|
Any feedback? |
Closed, because of no feedback. |
I am currently using Filemanager (with the PHP connector) on my file servers. The root filemanager folder is located in /var/www/data.
Everything works perfectly except the option 'Copy URL to Clipboard' which redirects me to a wrong link (http://my_server_ip/downloads/myfile).
The text was updated successfully, but these errors were encountered: