allow running, testing and scoring of files in subfolders by using the full filepath
This commit is contained in:
@ -270,8 +270,8 @@ configureEditors: function () {
|
||||
$('#files').jstree($('#files').data('entries'));
|
||||
$('#files').on('click', 'li.jstree-leaf', function (event) {
|
||||
this.setActiveFile(
|
||||
filename: $(event.target).parent().text(),
|
||||
id: parseInt($(event.target).parent().attr('id'))
|
||||
$(event.target).parent().text(),
|
||||
parseInt($(event.target).parent().attr('id'))
|
||||
);
|
||||
var frame = $('[data-file-id="' + this.active_file.id + '"]').parent();
|
||||
this.showFrame(frame);
|
||||
|
@ -2,8 +2,9 @@ CodeOceanEditorWebsocket = {
|
||||
websocket: null,
|
||||
|
||||
createSocketUrl: function(url) {
|
||||
var sockURL = new URL(window.location);
|
||||
sockURL.pathname = url;
|
||||
var sockURL = new URL(url, window.location);
|
||||
// not needed any longer, we put it directly into the url: sockURL.pathname = url;
|
||||
|
||||
// sanitize socket protocol string, strip trailing slash and other malicious chars if they are there
|
||||
sockURL.protocol = '<%= DockerClient.config['ws_client_protocol']&.match(/(\w+):*\/*/)&.to_a&.at(1) %>:';
|
||||
|
||||
|
@ -80,6 +80,14 @@ module CodeOcean
|
||||
end
|
||||
private :content_present?
|
||||
|
||||
def filepath
|
||||
if path.present?
|
||||
::File.join(path, name_with_extension)
|
||||
else
|
||||
name_with_extension
|
||||
end
|
||||
end
|
||||
|
||||
def hash_content
|
||||
self.hashed_content = Digest::MD5.new.hexdigest(file_type.try(:binary?) ? ::File.new(native_file.file.path, 'r').read : content)
|
||||
end
|
||||
|
Reference in New Issue
Block a user