Querystring in S3-Key - amazon-s3

It seems like you can upload files to s3 with a key including a questionmark, like:
test.html?p=1
But then i can not access it. If i try to access test.html?p=1 i will get the object stored with the key "test.html", is there some way to make this work? There is no problem if i end up on test.html if test.html?p=1 doesn't exist but if it exists i want to get that file.

Did you try urlencoding your request?
Use %3F instead of the "?"

Related

How to store URL in table and use as link on table?

I want to implement bookmark. I have problem with saving correct URL, when I store complete URL this link work till session is same as current.
I can store URL as:
'f?p=':APP_ID||':'||:APP_PAGE_ID
but what to store as a session? Pages are not public.
Don't reinvent the wheel - use APEX_PAGE.GET_URL instead. For example:
select APEX_PAGE.GET_URL (p_page => :APP_PAGE) as URL
from dual;
The result is then something like this:
f?p=12488:3:109743317382702:::::
Live screenshot from apex.oracle.com:

Unable to delete S3 objects with spaces in name

Through a typo I ended up creating a number of S3 files with spaces in their name. I realize based on the key naming guidelines that this is not an ideal situation, but the objects now exist. I have tried to delete them both from the AWS CLI and from the S3 console. Neither method produces an error, but the objects are not deleted. I tried renaming the files to remove the offending space, but this also fails on both CLI and console. How can I delete these objects?
Try using AWS SDKs (links to boto3 commands):
List the objects - See (boto3) S3.Client.list_objects
Filter the objects (keys) you want to delete from the list
Delete the objects of the filtered list using S3.Bucket.delete_objects
This answer applies to cases when you are using boto3 instead of aws cli but run into the same problem of the OP.
The problem:
When boto3 retrieves object names spaces in the key are encoded as "+" character. I don't know why the spaces are not url-encoded as %20 (although this post has answers that might explain why) Other special characters in the key name are url-encoded. Ironically "+" in an object name is encoded as %2B by boto3.
The solution:
Before passing a key name to boto3 delete_objects method, I cleaned up the key this way:
remove_plus = x-www-form-urlencoded_key.replace("+", " ")
uncoded_key = urllib.parse.unquote(remove_plus)
response = client.delete_object(
Bucket=bucket_name,
Key=uncoded_key
)
I suppose there's a more correct way of handling application/x-www-form-urlencoded type strings, but this is working for me right now.

How to get all the items contained inside a office365 onedrive

I want to get all the files and folders contained inside a office365 onedrive folder in one rest API call, is there any option to do it?
There isn't a specific API call to retrieve a flat representation of a Drive. You can achieve a similar effect however using the drive's search method.
Simply pass an empty query string and it will return metadata for each file (regardless of it's directory):
https://graph.microsoft.com/v1.0/me/drive/root/search(q='')
Ok, try this search request:
https://graph.microsoft.com/v1.0/me/drive/root/search(q='%2A')
Or:
https://api.onedrive.com:443/v1.0/drives/(driveid)/items/(itemid)/view.search?q=%2A
Where %2A is asterisk, itemid may be a root folder id. Don't forget about pagination.
Or with OneDriveSDK:
_connection.SearchForItemsAsync(odFolder.ItemReference(), "*", ItemRetrievalOptions.Default)
Don't use "expand" query with search query.
This should return all items in current folder recursively - sub-folders, sub-items.

ruby on rails AWS-S3 list files in a bucket

I have a select box the I wish to fill with filenames from a clients S3 bucket.
In my controller I set the variable as this:
#files = AWS::S3::Bucket.find("clientsbucket").objects
which when called in the view as options_for_select(#files) gives a list of objects but in the format of <AWS::S3::Object:0x4f9e5b8>, <AWS::S3::Object:0x4f9e5a0> etc
For the life of me I cant figure out how to list the filename instead of this object info?
Any help muchly appreciated
Well, access the key property of the each object in the view!
key property is the entire path to the file in the bucket.
objects.each do |object|
= object.key
Even though the AWS SDK Documentation isn't as informative try and dig around..
Use the as_tree method on the objects so you can get the specific data you want.
http://docs.amazonwebservices.com/AWSRubySDK/latest/AWS/S3/Tree.html
Good luck!!

Getting the data from backend to display it on Front end in X-CART

I am working on a X-Cart Module. I need the backend configuration values to the front end. In admin/configuration file I have created an array which contains the value which I need to use it in adv_search.php which is in the root folder. I don't know how to pass that array to adv_search.php.
Thanks in advance.
It is not quite clear how you store the configuration values. It may be easier to store them in the table xcart_config and access them directly as $config['Option-category']['option_name'] in php files and {$config.Option-category.option_name} in the Smarty-templates.
Or just define an array in module's config.php file and this array will be available everywhere in php-scripts. Look at the modules/UPS_OnLine_Tools/config.php file for example.