Skip to content
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

GSC Datastore: Add support for contentType property #130

Closed
wants to merge 2 commits into from

Conversation

tkrugg
Copy link

@tkrugg tkrugg commented Aug 23, 2018

closes #57

This PR follows up on #57

image

I couldn't get test/Test-GCSDataStore.js so i'll trust the travis output to fix the tests

@@ -106,6 +106,27 @@ class DataStore extends EventEmitter {
return resolve({ size: 0, upload_length: 1 });
});
}

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I moved this method here where it can be leveraged by any datastore (not just S3)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tkrugg tkrugg force-pushed the meta branch 2 times, most recently from 50f9d3b to ae8be92 Compare August 23, 2018 06:19
Copy link
Member

@Acconut Acconut left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much for this PR, it's looking good. However, it would be nice to have a GCS-specific test to see that this works properly.

const options = {
contentType: parsedMetadata.type.decoded,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tus-js-client uses the filetype metadata key to specify the file's type (see https://github.com/tus/tus-js-client#example). I would like it if we only had one property to do so. Would you mind changing it?
Besides that, a check to see if parsedMetadata.type actually exists might be necessary.

Copy link
Author

@tkrugg tkrugg Sep 14, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Besides that, a check to see if parsedMetadata.type actually exists might be necessary.

👍 will handle that

tus-js-client uses the filetype metadata key to specify the file's type

It should be possible, let me just check it still works 😄

Answering your global comment about this PR:

it would be nice to have a GCS-specific test to see that this works properly.

I was going to write it but I couldn't get the GCS test suite to run locally. It does run on travis. I may be missing some env variables. Are there a few steps to follow before running them locally?
Thank you very much for taking the time to review this PR. I appreciate.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Acconut small reminder about my question:

was going to write it but I couldn't get the GCS test suite to run locally. It does run on travis. I may be missing some env variables. Are there a few steps to follow before running them locally?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I responded to it in the main thread two days ago: #130 (comment)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry I've missed it. thanks!

const options = {
offset,
metadata: {
contentType: parsedMetadata.type.decoded,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, a check to see if parsedMetadata.type actually exists might be necessary.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you're right 👍 will add it

@Acconut
Copy link
Member

Acconut commented Sep 19, 2018

I was going to write it but I couldn't get the GCS test suite to run locally. It does run on travis. I may be missing some env variables. Are there a few steps to follow before running them locally?

Yes, there are a few steps to follow. They are not directly documented anywhere but that's on my list to improve. The basic steps should be:

  • Create a bucket on GCS
  • Save the keyfile from Google Cloud as keyfile.json in the root of the tus-node-server directory
  • Adjust the project Id and bucket name values in test-GCSDataStore.js:
    const PROJECT_ID = 'vimeo-open-source';
    const KEYFILE = path.resolve(__dirname, '../keyfile.json');
    const BUCKET = 'tus-node-server';
  • Upload the file test/test.mp4 as dont_delete_this_file.mp4 to your bucket

I think that should be all the steps. Let me know if they work for you.

Thank you very much for taking the time to review this PR. I appreciate.

You're welcome. Thank you very much for contribution.

tkrugg added 2 commits October 7, 2018 19:34
- using filetype instead of type
- added test
- handled case when metadata header is undefined
@Acconut
Copy link
Member

Acconut commented Oct 8, 2018

@tkrugg Were you able to have a look at the GCS-tests yet? Is this PR ready from your side?

@Murderlon
Copy link
Member

Closing this as stale and the source has now significantly diverged. Thanks for taking the time to contribute.

@Murderlon Murderlon closed this Dec 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

GSC Datastore does not support "contentType" property
3 participants