Skip to content

Commit efddf67

Browse files
committed
Remove hardcoded wp-uploads URL
1 parent c44f2eb commit efddf67

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

shorthand_connect/includes/api.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,13 @@ function sh_get_story_path($post_id, $story_id) {
6969
return $destination_path;
7070
}
7171

72+
function sh_get_story_url($post_id, $story_id) {
73+
WP_Filesystem();
74+
$destination = wp_upload_dir();
75+
$destination_url = $destination['url'].'/shorthand/'.$post_id.'/'.$story_id;
76+
return $destination_url;
77+
}
78+
7279
function sh_copy_story($post_id, $story_id) {
7380

7481
// Set the maximum memory limit for the entire operation (this is already called later by unzip_file, but lets do it earlier)

shorthand_connect/shorthand_connect.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ function shand_save_shorthand_story( $post_id, $post, $update ) {
208208
update_post_meta($post_id, 'story_path', $story_path);
209209

210210
// Get path to the assets
211-
$assets_path = get_site_url().substr($story_path, strpos($story_path, '/wp-content/uploads'));
211+
$assets_path = sh_get_story_url($post_id, $safe_story_id);
212212

213213
// Save the head and body
214214
$body = shand_fix_content_paths($assets_path, file_get_contents($story_path.'/component_article.html'));

0 commit comments

Comments
 (0)