Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Fix Rackspace getFiles Parameters #120

wants to merge 2 commits into from

4 participants


Rackspace returns different details with underscore, not with minus
content_type content-type

Example at issue #105

I dont now if this was a change in rackspace api (use it since a short time), so i leave content-type and the other changed fields as fallback in code.


@kenperkins is this a v1 vs v2 change?


I use rackspace since v2, i dont know how it look in v1. Thats why i leave the fallback parameters with - if there is not underscore value.


The v1 docs claim Content-Type ( but I'm reading from a v1 container and also had content_type returned.

I think this is safe to merge as is.


@rottmann I'm struggling to find a repo for this test.

Every time I request the properties for a file, I get headers with:

content-type: 'as/appropriate'

Can you help me understand your problem or help with a repro case?


I don't get "content-type" connecting to any CloudFiles container

cfg = require './config'
pkgcloud = require 'pkgcloud'

client = {
  provider: 'rackspace'
  username: cfg.rackspace.username
  apiKey: cfg.rackspace.key
client.getContainer 'media', (err, container) ->
  throw err if err
  client.getFiles container, (err, files) ->
    console.log files

connecting to first-gen cloudfiles container

{ hash: 'c7caa4ac037d4a7168503f6b2a5bdfc6',
  last_modified: '2013-01-13T16:59:47.581130',
  bytes: 51326,
  name: '2011/01/image.jpg',
  content_type: 'image/jpeg',
   { ...} 

connecting to open-cloud cloudfiles container

  { _events: {},
    newListener: false,
    _conf: { delimiter: '::', wildcard: true },
    delimiter: '::',
    wildcard: true,
    listenerTree: {},
    client:  { … },
    metadata: {},
    container: { … },
    name: '2013/05/image.jpg',
    etag: null,
    contentType: 'image/jpeg',
    lastModified: Fri May 10 2013 17:20:28 GMT-0400 (EDT),
    bytes: 371658,
    size: 371658 

OMG Rackspace change the name style again :( now they use CamelCase.
Now contentType, lastModified is returned.
I update my fork, i hope the rewrite of modul in main repo will finish soon.

@kenperkins kenperkins closed this

I've address this as I was already in the code; I see what you're saying btw, the API returns different values for getFile and getFiles, not pkgcloud proper.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on May 3, 2013
  1. @rottmann
Commits on May 29, 2013
  1. @rottmann
This page is out of date. Refresh to see the latest.
Showing with 6 additions and 6 deletions.
  1. +6 −6 lib/pkgcloud/rackspace/storage/file.js
12 lib/pkgcloud/rackspace/storage/file.js
@@ -61,16 +61,16 @@ File.prototype._setProperties = function (details) {
this.metadata = {};
this.container = details.container || null; = || null;
- this.etag = details.etag || null;
- this.contentType = details['content-type'] || null;
+ this.etag = details.hash || details.etag || null;
+ this.contentType = details['contentType'] || details['content_type'] || details['content-type'] || null;
- this.lastModified = details['last-modified']
- ? new Date(details['last-modified'])
+ this.lastModified = (details['lastModified'] || details['last_modified'] || details['last-modified'])
+ ? new Date(details['lastModified'] || details['last_modified'] || details['last-modified'])
: null;
- this.size = this.bytes = details['content-length']
- ? parseInt(details['content-length'], 10)
+ this.size = this.bytes = details['bytes'] || details['content-length']
+ ? parseInt(details['bytes'] || details['content-length'], 10)
: null;
Object.keys(details).forEach(function (header) {
Something went wrong with that request. Please try again.