GET and .xq files - xquery

When using exist-db, a GET message will obtain an entire file from a collection (by providing the URI). In the case of a .xq file, however, the same GET message will instead execute the file.
I am wondering if there is anything I can attach to a GET message to cause exist-db to return the file rather than execute it. I should have all the necessary permissions, or I should be able to set them.
Thank you.

Assuming you are running eXist as a stand-alone server:
"GET accepts the following request parameters, which must be URL-encoded" _source=yes | no - which "Specifies whether the query should display its source code instead of being executed" - see the developers guide online for full details & example usage.
eXist sets this capability to 'no' as default in it's config - however you can override this permanently by adding specific files to the <allow-source></allow-source> section in the Web-application Descriptor file (descriptor.xml) read from WEB-INF directory of the web application or from the directory specified by the exist.home system property.
Hope that helps.

Related

Unable to delete uploaded XML file on Drupal 8.5

I have created a media type that accepts XML files and saves them to a custom publicly accessible location on the server.
Ideally I would like the file to be overwritten when the exact same file is uploaded. This does not happen, instead it creates a new file and adds a number on the end. I have "Create new Revision" turned off.
To get around this issue I thought I could just delete the file via the CMS. The uploaded file has status of "Permanent" and is used 0 places. I know the cron job cleans up files for you, but when I run the cron the file in question is still there. I figure it's because the file is set to permanent, but I don't see a way to flip this to temporary.
Any help is much appeciated.
There is a setting nested away in the file system settings, which lets you configure it to remove (or not removed) orphaned files. If drush isn't removing them despite having no usages recorded, I'd check this option isn't ticked.
The temporary and permanent status are used for storing temporary files during the upload/save process, so I wouldn't tinker with those too much.
If you fancy making the form yourself using the form API, then you can save the file programmatically using the FILE_EXISTS_REPLACE parameter.
https://api.drupal.org/api/drupal/core%21modules%21file%21file.module/function/file_save_data/8.5.x

Demandware - Pipeline not found for current domain

I already made pipeline. Which is working fine. Suddenly it give error like
2015-12-18 02:39:08.091 GMT] ERROR system.core ISH-CORE-2368 Sites-SiteGenesis-Site core Storefront [uuid] [request-id]-0-00 [timestamp] "Error executing pipeline: Hello com.demandware.beehive.core.capi.pipeline.PipelineExecutionException:Pipeline not found (Hello) for current domain (Sites-SiteGenesis-Site)"
Does anybody know how to solve this?
In the event that your pipeline can not be found for the selected domain, please go trough and verify all of the following:
Double check Pipeline-Node naming
Pipeline URLs are generated by their name and your desired entry node, in this scenario, I would expect a file named Hello.xml in you cartridge's pipeline directory, and a start node named Start, would be accessed via {instanceURL}/on/demandware.store/Sites-mySite-Site/Hello-Start
Try and force upload of your cartridges
Occasionally the files on the server will not be updated correctly when a save is made; to force an update, right click your project, click Demandware > Upload Cartridges
Check your Cartridge Path
If you are using a shared instance, or your instance is re-provisioned, you may need to check your cartridge path to be sure your custom cartridge(s) are still there.
Check your Code Versions
Occasionally you may increment / change your code version - if you do, make sure that the path you select in Studio is the one that you have selected in Business Manager.
Tech Support
Should you still have issues following the four steps above, please file a support ticket and the tech-support team will be able to provide you with more assistance.

Not able to download file name containing 'aspx' character in asp .net

Am developing asp .Net web application.
In one of my aspx file am using file to download using generic handler. Everything works great. But when am testing i felt a strange problem. That, if am uploading a image or document with file name containing aspx character for Eg; aspxphoto as file name.
Uploading doesnt have any any problem but when i try to download it is throwing error in Generic handler file as
Object reference not set to an instance of an object.
Can anyone help me why this problem happends and how can i fix it?
You will not be able to do this. The IIS handler wants to "handle" the ASPX. You should simply not allow it, or if you have to, rename it to .aspx.uploaded or something. If you allowed, it you could open yourself to hacking.
As another option, you may be able to create a virtual that implements ("no processing") - possibly using the HTTP Handler under the virtual and just disabling script / execute permissions (under handler >> Edit Feature Permission >> Script OR under Virtual >> Edit permissions >> Special >> Turn Execute off.
I would not recommend the last, since it will add complexity when migrating between test and live AND for recovery (DR).

Spring MVC get full file path during file upload

Am using spring mvc and working on file upload. I get the file name successfully passed to my controller and it is of type MultiPartFile. But it is returning only the file name. But i need the path of the file also. Can anyone help me?
From Spring documentation.
"MultipartFile.getOriginalFilename()
This may contain path information depending on the browser used, but it typically will not with any other than Opera."
However what you are asking could be a security concern as you can get file system info in full path beside browser don't generally pass this information. check answer by craigd and others in another question 1130560

Updating folders and folder contents with Tridion WebDAV

I'm facing a problem, and don't know if anybody has solved this issue.
I'm using Tridion webdav (Tridion 2011 SP1 HR1) to insert structured content (folders + binary files) into a publication.
All goes well when the folder doesn't exist, but if the folder exist, then an error appear:
You do not have permission to access this Web Folder location
Watching the log files, the problem is that Tridion tries to create a new folder when I drag & drop an existing folder, and rename to the folder title, giving an error:
Name must be unique for items of type: Folder/Virtual Folder within this Folder and its BluePrint context.
I tried using Events to avoid saving the folder when it exists (throwing an exception in the initiated phase), but the permission error appears when updating the content inside the folder.
Has anyone tried to do something alike?
Has anyone any sugestion I can try?
Thank you all in advance.
This has nothing to do with Tridion as you are using Windows Explorer to access WebDAV, so if anything it's the Explorer who is to blame for sending wrong requests, but if you will take a look at WebDAV sprcification here: http://www.webdav.org/specs/rfc4918.html, you can see all the possible calls under chapter 9.
Tridion Folders are treated as collections, so there's a MKCOL call to create a folder, but if you will check 9.7.2 PUT for Collections, you will see:
9.7.2 PUT for Collections
This specification does not define the behavior of the PUT method for existing collections. A PUT > request to an existing collection MAY be treated as an error (405 Method Not Allowed).
The MKCOL method is defined to create collections.
So there's no way to update existing folders, it's create and upload contents, indeed.
You can also check this article if you are interested in WebDAV protocol: http://amarchuk.blogspot.nl/2011/10/heres-c-webdav-client-that-works-with.html

Resources