-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Support Zip files for Course Import #33539
Conversation
Thanks for the pull request, @rodfersou! Please note that it may take us up to several weeks or months to complete a review and merge your PR. Feel free to add as much of the following information to the ticket as you can:
All technical communication about the code itself will be done via the GitHub pull request interface. As a reminder, our process documentation is here. Please let us know once your PR is ready for our review and all tests are green. Once you've signed the CLA, please allow 1 business day for it to be processed. After this time, you can re-run the CLA check by adding a comment here that you have signed it. If the problem persists, you can tag the |
d830b45
to
f643f3a
Compare
@@ -35,7 +35,7 @@ define([ | |||
var filepath = $(this).val(), | |||
msg; | |||
|
|||
if (filepath.substr(filepath.length - 6, 6) === 'tar.gz') { | |||
if (/\.tar.gz$|\.zip$/.test(filepath)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question: ❓ should I add a global configuration for this like python code?
or maybe keep this regex defined in the top of the file for reuse?
openedx/core/lib/extract_zip.py
Outdated
return members | ||
|
||
|
||
def safezip_extractall(zip_file, path=".", members=None): # pylint: disable=unused-argument |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thought: 💭 this could be a monkey patch
openedx/core/lib/extract_zip.py
Outdated
|
||
Adapted from: | ||
http://stackoverflow.com/questions/10060069/safely-extract-zip-or-tar-using-python | ||
""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thought: 💭 This file could be merged with openedx/core/lib/extract_tar.py
Tried to keep the changes minimal by create a new file
f643f3a
to
a7b17b4
Compare
cms/djangoapps/contentstore/tasks.py
Outdated
@@ -35,7 +36,7 @@ | |||
from organizations.api import add_organization_course, ensure_organization | |||
from organizations.exceptions import InvalidOrganizationException | |||
from organizations.models import Organization, OrganizationCourse | |||
from path import Path as path | |||
from pathlib import Path as path |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick: ⛏️ suffixes
are available just in pathlib
@@ -27,7 +27,7 @@ | |||
from edx_django_utils.monitoring import set_custom_attribute, set_custom_attributes_for_course_key | |||
from opaque_keys.edx.keys import CourseKey | |||
from opaque_keys.edx.locator import LibraryLocator | |||
from path import Path as path | |||
from pathlib import Path as path |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick: ⛏️ suffixes
are available just in pathlib
8f2ac2f
to
d0d629b
Compare
mocked_log.error.assert_called_once_with(expected_error_mesg) | ||
|
||
status_response = self.get_import_status(self.course.id, self.good_zip) | ||
self.assertImportStatusResponse(status_response, self.UnpackingError, import_error.UNSAFE_TAR_FILE) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thought: 💭 create import_error.UNSAFE_ZIP_FILE
2471a2c
to
634a252
Compare
ed5d7a7
to
b417684
Compare
e06b195
to
cf9d26f
Compare
0ccf17d
to
2e75ced
Compare
@rodfersou Even though your pull request wasn’t merged, please take a moment to answer a two question survey so we can improve your experience in the future. |
1 similar comment
@rodfersou Even though your pull request wasn’t merged, please take a moment to answer a two question survey so we can improve your experience in the future. |
Description
Support
zip
files for Course import.Please see more details at this issue: openedx/platform-roadmap#285
Useful information to include:
=> "Course Author".
=> Before
Supporting information
Link to other information about the change, such as Jira issues, GitHub issues, or Discourse discussions.
Be sure to check they are publicly readable, or if not, repeat the information here.
https://tasks.opencraft.com/browse/BB-8025
openedx/platform-roadmap#285
Testing instructions
Tools / Export
Export Course Content
.tar.gz
file in a new folder at your computer.zip
fileTools / Import
Choose new file
.zip
fileReplace my course with the selected file
Deadline
=> 2023-10-29
Other information
Include anything else that will help reviewers and consumers understand the change.
=> No
=> No
=> No