Creating link to file location on network in confluence - windows

On confluence I want to create a link that links to:
P:\myFolder\folder, where P is mapped to a network share.
Just putting in "P:\myFolder\folder" doesn't work. Any ideas?
(Assuming I cannot put in the full network path).

typically what would work is
file:///p:/myFolder/folder/
If there are spaces in the name like 'My Documents' you can surround the link with [ ]
[file:///p:/my Folder/folder/]
Of course you can also add an alias:
[The Folder|file:///p:/my Folder/folder/]
I just tested a variation of this and it seemed to work.
[file:///\\\\servername/share/folder/file.ext] works in IE (note two back slashes in front for the server name)

As Vladimir Alexiev writes, the browser might need some setting up. Firefox and Opera do not allow opening links to local files. This is for security purposes.
Have a look at http://confluence.atlassian.com/display/JIRA/Linking+to+local+file+under+Firefox (This page is located within the JIRA documentation, but the information is not JIRA-specific.)

The following worked for me on Windows 7 under Firefox 24.5:
\\\\servername\share\folder\
translates to:
file://///servername/share/folder
That is 5 forward slashes.

no need to use file:\\\;
just put as
download
where localhost is your server name;

You can setup Shortcut Links* (Browse>Admin>Shortcut Links) to make this easier. Then you can write e.g. [myFolder/folder#P]
You may also need to take care for your browser to open the links. That depends by browser.

Related

MAMP/WAMP - Which process is yours to alternate between your online websites (URLs, https, ssl) and local developpment (URLs, https,ssl)

how is it adviced to alternate between online and local development, since you want to modify your websites on local.
Do you systematically change all URLs (by search/replace) in your project code to fit local URL type and sometimes create personal SSL certificate for https, or do you use another solution like localhost aliases, rewrite rules, or online developpement tools?
What could be an automatic solution in order to avoid this fastidious modifications like search/replace sometimes looking quite primitive and time costing since I develop during the few hours left after my main work.
What are the operation modes to facilitate developpment,
Have a nice day,
for all the biginners, here's the thing.
I've created a config.php file which contains constants: one config file for the local project folder and one for the online server folder.
Inside this config file, I've create a constant (constant are then available everywhere in the project) to define the main URL of the project. e.g.:
define('CST_MAIN_URL',http://www.myproject.com); // for the online config.php file
define('CST_MAIN_URL',http://localhost:8888); // for the local config.php file
Thus, each header or redirection can work with that constant, like:
header('location:' . CST_MAIN_URL . 'index.php');
Then, things must have to do with RewriteEngine in your htaccess file, for instance whenever you must modify the behavior of MAMP/WAMP if an interrogation point or a slash provokes you with its malicious resistance. But, unfortunately RegEx expression must be understood as a basic level for mastering those url rewritings.
Hope it'll helps.

How to find out the document root or find out actual path of a URL in cPanel server?

First of all, I searched in Google to my level best to find the answer and not able to even get some clue on this.
I want to find out the actual path in the server for a given URL. I have root access.
For example, I want to write a script, It takes URL as a input and prints the actual path in the server.
Example Input: some.com/wp-includes/js/tinymce/plugins/media/js/file.php
abcd.com/wp-includes/js/tinymce/plugins/wpgallery/img/xml.php
The output should be
/home/some/public_html/wp-includes/js/tinymce/plugins/media/js/file.php
/home/abcd/public_html/wp-includes/js/tinymce/plugins/wpgallery/img/xml.php
The domain name can be add-on, or sub-domain , But it is hosted on the same server.
I want to write a shell script to achieve this. Please guide me.
I want this to be done using Linux shell script only and not using PHP.
There is a perl based cPanel API for getting this information. Without that, It is very tough to implement it or i have not seen any code on Internet. So I dropped this.
From any PHP code running in browser you can use:
# prints DocumentRoot path
echo $_SERVER["DOCUMENT_ROOT"];
# prints full filesystem path of the script
echo $_SERVER["SCRIPT_FILENAME"];

Get a dropbox url from the command line

I'm a windows 7 user and I want to access an object from within my public dropbox folder using the command line. How do I do that (note my skills with the command line are weak so be gentle please. This is what I'm basing my information on: DROPBOX CITE LINK
Here's the path to my drop box and what I attempted:
#the path
C:/Users/trinker/Dropbox/Public/plot.png
#the attempt to retrieve the url of plot.png
CD C:/Users/trinker/Dropbox/Public/
C:/Users/trinker/Dropbox/bin/dropbox.py puburl C:/Users/trinker/Dropbox/Public/plot.png
Note my slashes are going the opposite way you'd normally see them on a windows machine as I'm using this within another program that requires the slashes be in this direction or doubled as in \\
The goal is to retrieve the url for the dropbox object.
There is a work around pointed out to me by my friend Dason. Go to your public folder and copy the link from a file. Here's one of mine:
https://dl.dropboxusercontent.com/u/61803503/%20wordcloud.pdf
The account number is always the same for your own drop box. So the following form will allow me to share documents:
file.path("https://dl.dropboxusercontent.com/u/61803503", DOCUMENT_NAME_HERE)
I don't know exactly what you are doing but if that is the url to your dropbox share, and you just wanted to access via command line have you tried just mapping a network drive to that URL to see if it works?

Firefox and Content-Disposition header

I have a problem with an attachment's name. When I call the site on google chrome it returns the file with the right name and extension. I tested it with internet explorer and it works fine too. The issue lies with only Firefox. I call the site and it returns the first word on the file title and no extension.
For example if I wanted a file called "My report.docx" it turns a file called "My". I Googled around and it turns out this is a common issue with people because browsers read the headers differently. They said the fix is to quote the file name:
Content-Disposition: attachment; filename=My Report.docx
is now: (note the quotes)
Content-Disposition: attachment; filename="My Report.docx"
However, that did not work for me.
On chrome it returned "My Report.docx" (actually with the quotes). Firefox returned a odd file that had the proper extension and proper name and no quotes yet it could not be executed. It was the proper file size, proper extension, and proper name yet it could not be executed. Also it returns a space before and after the file name.
I know this is a very old question, but I was recently having the same problem. The solution is to either
Encode your filename per RFC2184 or,
If you don't have special characters in your filename, quote it in the content disposition string.
Since you've already tried 2, you could try using 1 and seeing how that works out.
Usually I use the ContentDisposition class to generate my header for me:
Dim contentDispositionHeader = New Net.Mime.ContentDisposition() With {.FileName = filename}
Response.AddHeader("Content-Disposition", contentDispositionHeader.ToString())
Hope this helps.
This should work as expected, here's another SOq with the same problem:
Downloading a file with a different name to the stored name
and also the Mozilla page (I guess you were referencing this one):
http://kb.mozillazine.org/Filenames_with_spaces_are_truncated_upon_download
I don't know the specifics of your server side code, but here are some things to confirm / try:
If you have PHP available at the server, can you try the code from the first link above? If not, you can probably find something on the Net in your language of choice. That way, you can confirm whether the issue is in your code or somewhere else (server setup, browser, etc.)
Is this happening on other client machines (i.e. where you try the download from) or only on that one? You might want to try others to confirm.
Is this working fine in IE / Safari or some other browser? You can even try doing it with wget or curl from the command line or something like that.
Are you also providing the Content-Type header correctly?
Can you try downloading some other file or a file of a different type, e.g. a .png or a .xls? In fact, probably the easiest would be to try a plain text file (text/plain) and then take it from there.
Hope this helps.

Launching a registered mime helper application

I used to be able to launch a locally installed helper application by registering a given mime-type in the Windows registry. This enabled me to allow users to be able to click once on a link to the current install of our internal browser application. This worked fine in Internet Explorer 5 (most of the time) and Firefox but now does not work in Internet Explorer 7.
The filename passed to my shell/open/command is not the full physical path to the downloaded install package. The path parameter I am handed by IE is
"C:\Document and Settings\chq-tomc\Local Settings\Temporary Internet Files\
EIPortal_DEV_2_0_5_4[1].expd"
This unfortunately does not resolve to the physical file when calling FileExists() or when attempting to create a TFileStream object.
The physical path is missing the Internet Explorer hidden caching sub-directory for Temporary Internet Files of "Content.IE5\ALBKHO3Q" whose absolute path would be expressed as
"C:\Document and Settings\chq-tomc\Local Settings\Temporary Internet Files\
Content.IE5\ALBKHO3Q\EIPortal_DEV_2_0_5_4[1].expd"
Yes, the sub-directories are randomly generated by IE and that should not be a concern so long as IE passes the full path to my helper application, which it unfortunately is not doing.
Installation of the mime helper application is not a concern. It is installed/updated by a global login script for all 10,000+ users worldwide. The mime helper is only invoked when the user clicks on an internal web page with a link to an installation of our Desktop browser application. That install is served back with a mime-type of "application/x-expeditors". The registration of the ".expd" / "application/x-expeditors" mime-type looks like this.
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.expd]
#="ExpeditorsInstaller"
"Content Type"="application/x-expeditors"
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\ExpeditorsInstaller]
"EditFlags"=hex:00,00,01,00
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\ExpeditorsInstaller\shell]
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\ExpeditorsInstaller\shell\open]
#=""
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\ExpeditorsInstaller\shell\open\command]
#="\"C:\\projects\\desktop2\\WebInstaller\\WebInstaller.exe\" \"%1\""
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\MIME\Database\Content Type\application/x-expeditors]
"Extension"=".expd"
I had considered enumerating all of a user's IE cache entries but I would be concerned with how long it may take to examine them all or that I may end up finding an older cache entry before the current entry I am looking for. However, the bracketed filename suffix "[n]" may be the unique key.
I have tried wininet method GetUrlCacheEntryInfo but that requires the URL, not the virtual path handed over by IE.
My hope is that there is a Shell function that given a virtual path will hand back the physical path.
I believe the sub-directories created by IE are randomly generated, so you won't be able guarantee that it will be named the same every time, and the problem I see with the registry method is that it only works when the file is still in the cache...emptying the cache would purge the file requiring yet another installation.
Would it not be better to install this helper into application data?
I'm not sure about this but perhaps this may lead you in the right direction: try using URL cache functions from the wininet DLL: FindFirstUrlCacheEntry, FindNextUrlCacheEntry, FindCloseUrlCache for enumeration and when you locate an entry whose local file name matches the given path maybe you can use RetrieveUrlCacheEntryFile to retrieve the file.
I am using a similar system with the X-Appl browser to display WAML web applications and it works perfectly. Maybe you should have a look at how they managed to do it.
It looks like iexplore is passing the shell namespace "name" of the file rather than the filesystem name.
I dont think there is a documented way to be passed a shell item id on the command line - explorer does it to itself, but there are marshaling considerations as shell item ids are (pointers to) binary data structures that are only valid in a single process.
What I might try doing is:
1. Call SHGetDesktopFolder which will return the root IShellFolder object of the shell namespace.
2. Call the IShellFolder::ParseDisplayName to turn the name you are given back into a shell item id list.
3. Try the IShellFolder::GetDisplayNameOF with the SHGDN_FORPARSING flag - which, frankly, feels like w'eve just gone in a complete circle and are back where we started. Because I think its this API thats ultimately responsible for returning the "wrong" filesystem relative path.
Some follow-up to close out this question.
Turned out the real issue was how I was creating the file handle using TFileStream. I changed to open with fmOpenRead or fmShareDenyWrite which solved what turned out to be a file locking issue.
srcFile := TFileStream.Create(physicalFilename, fmOpenRead or fmShareDenyWrite);

Resources