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

blog folder rename failure issue #49

sryu opened this Issue May 18, 2018 · 11 comments


None yet
2 participants

sryu commented May 18, 2018

I am using pulse v51b3 and b4. pulse is installed as a subdirectory in the root dir, and functions as expected.

In Admin >> Blog, I want to manage two sub folders named "draft" and "hide" so that I can start a new blog in the draft folder, work on it, and then move out into the main blog folder so that it is seen in public. Also, I want to be able to move blogs into hide folder to hide them from view without having to delete them.

I create the folders and they seem to serve the purpose well. However, when I try to re- name these folders I created, pulse gives me error "Unknown extension detected". The only way to change the name seem to be to delete and create a new folder with the changed name....?

Is this a bug or these folders are designed not to be renamed?

@yuzoolcode yuzoolcode added the bug label May 18, 2018


This comment has been minimized.


yuzoolcode commented May 18, 2018

They should be able to be renamed so might be a bug...
Will check on this

In the meantime, you can draft posts:

e.g. "draft-1.txt" will put the post in Draft mode


This comment has been minimized.


yuzoolcode commented Jun 8, 2018

Can't replicate this one. Created draft and hide blog folders. Can rename those. Can also rename any content in those folders.

Can you send in Logs? (Pulse admin > settings > Extend ? Download logs)


This comment has been minimized.

sryu commented Jun 10, 2018

I just tried again. First creating a blog directory named "test". Then I choose it to rename "test2", but pulse says "Unknown extension detected" and refuse to change.
The debug log file does not register anything related to this it seems, since the last entry there is from 10 hours ago. I am sending it anyway.


This comment has been minimized.


yuzoolcode commented Jun 11, 2018

The more I look at it the odder it seems!

The install is in /home3/mathgame/public_html/ymb/pulse/ but the logs show errors from /home3/mathgame/public_html/ymb/media/index.php

So there are some Pulse includes in that.

The actual rename code only shows the error "unknown extension detected" for files which don't have extensions in the allowed image types. This isn't an error that should be seen when renaming a blog folder.

  • So I suspect there may be a blog item file with the same name of the subblog that's being renamed?
  • Or contains uploads not listed in Admin settings?

Let us know!


This comment has been minimized.

sryu commented Jun 11, 2018

I think you are looking at the earlier log entries. To be clear on that, let me try to create an empty folder named "lala" in "blocks" (not "blog"), then immediately rename it to "gaga", on my local machine. (pulse51b4 installed on OSX, as a sub-dir to root).

To be sure, I generate the debug log (will call "before") before I try this, and then generate another (will call "after") after I try this.

There are no files involved. Here are the steps I take:

  1. Create an empty sub-dir named "lala" in the blocks dir. It creates one successfully.
  2. I try to rename it by tapping on the light gray "[Rename]" link on the right end of the nav bar.
    It invokes http://localhost:8888/pulse/admin/index.php?p=rename&d=blocks%2Flala
    and display an input field for the new name.
  3. I type in the new name, "gaga", and press the red "Rename" button next to the field.
  4. Pulse comes back with the "Unknown extension detected", with the original name replacing the new one in the input field. Nothing happened, and no new entry regarding this in the error_log_2018_06_12.log file.
    (don't mind the entries there at the end which ends with .... No such file or directory in /Users/sryu/Desktop/CloudStation/Sites/seungohryu/pulse/admin/inc/rename.php on line 53_
    as they are related to an earlier tests I did in which I tried to rename an existing file by using a non-existing subfolder name....)


BTW, what's the real purpose of creating a subfolder inside the "blog" directory other as far as blog management is concerned? As I understand it, there is no obvious way to manage multiple blogs for a site, right?


This comment has been minimized.


yuzoolcode commented Jun 12, 2018

Thanks will take a look.

Yes - subfolders inside the "blog" allow you to have multiple blogs on 1 site :)


This comment has been minimized.


yuzoolcode commented Jun 13, 2018

I've tested this and I cant replicate it 😔

The debug logs aren't much help. The only possibility left is that there is a block with the same name as the renamed block folder?


This comment has been minimized.

sryu commented Jun 13, 2018

I am stymied that it is not re-produceable on your part... I downloaded the fresh 5.1b4, and to simplify things, uncompressed it on my OSX desktop, started MAMP, and let it point to the pulse folder as the root directory. From then on, followed the simple pulse start instruction - running the install.php.

Then, went localhost:8888/admin, created a new dir in blocks, and then try to rename that empty folder. Always get the same error. Tried various names. There is no chance that a naming conflict is the issue...

Creating a new file in and out of these test folders has no problem. Renaming the files work fine. It is just renaming the folders (same problem in blocks, blogs, media). I can change the folder name using my ftp client, and for now, that seems to be the only way to rename folder. It is not comforting that pulse gives me trouble at this very basic level. All the more so if it is only my system....!

(I also repeated the same on the official pulse5 package, not the beta 4. Interface interaction seems slightly different, but still the same issue.)


This comment has been minimized.

sryu commented Jun 13, 2018

I am no expert on php, but I located the code (rename.php) that outputs the error message. I modified that line to give out a bit more information, namely outputting also the $new and $old. It turns out that the code added "." at the end of each, (which shouldn't since they are both directories?)

Here is the modified code:

$_SESSION['rename-error'] = "Unknown extension detected : [" . $old . "]-->[". $new . "]";

When I try to change the dir name from "sryu" to "sryunew", it spelled out the following message:

Unknown extension detected : [/Users/sryu/Desktop/Pulsecms51b4/content/blocks/sryu.]-->[/Users/sryu/Desktop/Pulsecms51b4/content/blocks/sryunew.]

Note that "." is attached to the end of either string which in this case were meant to be directory names. And that should have been caught as error here.

I also think that \is_dir() function does not work. It probably cannot distinguish btwn a file with no extension and just a plain directory...? --- that's probably why in the original code, providing a directory name just fell through the crack, leading to the error.
[I read somewhere that in unix, pretty much everything is treated as file. Now, I am not sure \is_dir function behaves in the same way across platforms or not. Please verify... ]


This comment has been minimized.

sryu commented Jun 13, 2018

Here is my proposed solution in the rename.php:

if($param_post_ext != NULL)   

definitely a file!

	$old = \pulsecore\get_configs()->dir_content . '/' .$param_post_fullpath . '.' . $param_post_ext;
	$new = \pulsecore\get_configs()->dir_content . '/' .$param_post_main_folder . $rename . '.' . $param_post_ext;

	# error trapping

here check if the file extension is among the allowed... if not kill
!\is_dir($old) fails to eliminate dir as I mentioned in the previous comment
but that is fine, since the ($param_post_ext != NULL) filter already takes care of it

	if (!\is_dir($old) and !\in_array($param_post_ext, \array_merge( array('txt'), \pulsecore\get_configs()->media_files->image_types))) 
		$_SESSION['rename-error'] = "Unknown extension detected : [" . $old . "]-->[". $new . "]" . $param_post_ext;
		\header("Location:index.php?p=rename&d=" . $param_post_fullpath . "&e=" . $param_post_ext);

no extension provided - likely dir, but may also be files without extension....

	$old = \pulsecore\get_configs()->dir_content . '/' .$param_post_fullpath ;
	$new = \pulsecore\get_configs()->dir_content . '/' .$param_post_main_folder . $rename;

as a safe measure make sure old and new are not identical before renaming!

if($old != $new) 
	\rename($old, $new);

Seems to work fine now, at least for me. Hope this or better solution fixes the issue in the next version.


This comment has been minimized.


yuzoolcode commented Jun 15, 2018

Thanks for the info.

I think this is a weird bug. The "." is appearing at the end of the directory names. It still renames as expected though on our side. I suspect if this was broken we'd have seen lots of other bug reports. Odds are it might be something Mac related or something else (although tested on mac and pc)

We cleaned up the code a little for this issue and this will be in 5.1B5. The fix basically removes the trailing dot for directory renames (an empty file extension).

PHP is_dir does test for directories properly Files and directories are different on the file system.

Unix does treat just about everything as files. The trick is that a directory is a kind of file, so there are other operations attached to it.

Let’s close this for now and if still occurs on 5.1B5 then we’ll have to re-open it and look for a fix for 5.2 but this should be all good now :)

@yuzoolcode yuzoolcode closed this Jun 15, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment